Skip to content

Commit 62068d5

Browse files
committed
Updated signSchema comment text
Fixed issues in nacl_catalupt class
1 parent 075ca67 commit 62068d5

File tree

2 files changed

+11
-11
lines changed

2 files changed

+11
-11
lines changed

src/core/crypto/SignSchema.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@
1515
*/
1616

1717
/**
18-
* [KECCAK_REVERSED_KEY]: Keccak hash algorithm with key reversed.
19-
* [SHA3]: Sha3 hash algorithm without key resersed
18+
* [KECCAK_REVERSED_KEY]: Keccak hash algorithm with reversed private keys.
19+
* [SHA3]: SHA3 hash algorithm without key reversal
2020
*/
2121
export enum SignSchema {
2222
KECCAK_REVERSED_KEY = 1,

src/core/crypto/nacl_catapult.ts

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -42,22 +42,22 @@ const gf0 = gf(),
4242
gf1 = gf([1]),
4343
_121665 = gf([0xdb41, 1]),
4444
D = gf([0x78a3, 0x1359, 0x4dca, 0x75eb, 0xd8ab, 0x4141, 0x0a4d,
45-
0x0070, 0xe898, 0x7779, 0x4079, 0x8cc7, 0xfe73, 0x2b6f, 0x6cee, 0x5203,
45+
0x0070, 0xe898, 0x7779, 0x4079, 0x8cc7, 0xfe73, 0x2b6f, 0x6cee, 0x5203,
4646
]),
4747
D2 = gf([0xf159, 0x26b2, 0x9b94, 0xebd6, 0xb156, 0x8283, 0x149a,
48-
0x00e0, 0xd130, 0xeef3, 0x80f2, 0x198e, 0xfce7, 0x56df, 0xd9dc, 0x2406,
48+
0x00e0, 0xd130, 0xeef3, 0x80f2, 0x198e, 0xfce7, 0x56df, 0xd9dc, 0x2406,
4949
]),
5050
X = gf([0xd51a, 0x8f25, 0x2d60, 0xc956, 0xa7b2, 0x9525, 0xc760,
51-
0x692c, 0xdc5c, 0xfdd6, 0xe231, 0xc0a4, 0x53fe, 0xcd6e, 0x36d3, 0x2169,
51+
0x692c, 0xdc5c, 0xfdd6, 0xe231, 0xc0a4, 0x53fe, 0xcd6e, 0x36d3, 0x2169,
5252
]),
5353
Y = gf([0x6658, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666,
54-
0x6666, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666,
54+
0x6666, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666,
5555
]),
5656
I = gf([0xa0b0, 0x4a0e, 0x1b27, 0xc4ee, 0xe478, 0xad2f, 0x1806,
57-
0x2f43, 0xd7a7, 0x3dfb, 0x0099, 0x2b4d, 0xdf0b, 0x4fc1, 0x2480, 0x2b83,
57+
0x2f43, 0xd7a7, 0x3dfb, 0x0099, 0x2b4d, 0xdf0b, 0x4fc1, 0x2480, 0x2b83,
5858
]);
5959
const L = new Float64Array([0xed, 0xd3, 0xf5, 0x5c, 0x1a, 0x63, 0x12, 0x58, 0xd6, 0x9c,
60-
0xf7, 0xa2, 0xde, 0xf9, 0xde, 0x14, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0x10,
60+
0xf7, 0xa2, 0xde, 0xf9, 0xde, 0x14, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0x10,
6161
]);
6262

6363
const A = (o, a, b) => {
@@ -672,16 +672,16 @@ export const cleanup = (arr) => {
672672
}
673673
};
674674

675-
export const crypto_shared_key_hash = (shared, pk, sk, hashfunc, hasherType) => {
675+
export const crypto_shared_key_hash = (shared, pk, sk, hashfunc, signSchema) => {
676676
const d = new Uint8Array(64);
677677
const p = [gf(), gf(), gf(), gf()];
678678

679-
hashfunc(d, sk, 32, hasherType);
679+
hashfunc(d, sk, 32, signSchema);
680680
d[0] &= 248;
681681
d[31] &= 127;
682682
d[31] |= 64;
683683

684-
const q = [gf(), gf(), gf(), gf()];
684+
let q = [gf(), gf(), gf(), gf()];
685685
unpackneg(q, pk);
686686
scalarmult(p, q, d);
687687
pack(shared, p);

0 commit comments

Comments
 (0)