forked from bcoin-org/bcrypto
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcshake128.js
65 lines (50 loc) · 1.17 KB
/
cshake128.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
/*!
* cshake128.js - CSHAKE128 implementation for bcrypto
* Copyright (c) 2017-2019, Christopher Jeffrey (MIT License).
* https://github.com/bcoin-org/bcrypto
*/
'use strict';
const CSHAKE = require('./cshake');
/**
* CSHAKE128
*/
class CSHAKE128 extends CSHAKE {
constructor() {
super();
}
init(name, pers) {
return super.init(128, name, pers);
}
static hash() {
return new CSHAKE128();
}
static hmac(name, pers, len) {
return super.hmac(128, name, pers, len);
}
static digest(data, name, pers, len) {
return super.digest(data, 128, name, pers, len);
}
static root(left, right, name, pers, len) {
return super.root(left, right, 128, name, pers, len);
}
static multi(x, y, z, name, pers, len) {
return super.multi(x, y, z, 128, name, pers, len);
}
static mac(data, key, name, pers, len) {
return super.mac(data, key, 128, name, pers, len);
}
}
/*
* Static
*/
CSHAKE128.native = CSHAKE.native;
CSHAKE128.id = 'CSHAKE128';
CSHAKE128.size = 16;
CSHAKE128.bits = 128;
CSHAKE128.blockSize = 168;
CSHAKE128.zero = Buffer.alloc(16, 0x00);
CSHAKE128.ctx = new CSHAKE128();
/*
* Expose
*/
module.exports = CSHAKE128;