mirror of
https://github.com/nbd-wtf/nostr-tools.git
synced 2026-10-05 14:38:23 +00:00
nip44: fix test sha256.
This commit is contained in:
+2
-2
@@ -3,6 +3,7 @@ import { v2 } from './nip44.js'
|
|||||||
import { bytesToHex, hexToBytes } from '@noble/hashes/utils.js'
|
import { bytesToHex, hexToBytes } from '@noble/hashes/utils.js'
|
||||||
import { default as vec } from './nip44.vectors.json' with { type: 'json' }
|
import { default as vec } from './nip44.vectors.json' with { type: 'json' }
|
||||||
import { schnorr } from '@noble/curves/secp256k1.js'
|
import { schnorr } from '@noble/curves/secp256k1.js'
|
||||||
|
import { sha256 } from '@noble/hashes/sha2.js'
|
||||||
|
|
||||||
const v2vec = vec.v2
|
const v2vec = vec.v2
|
||||||
|
|
||||||
@@ -216,8 +217,7 @@ test('spec test vectors: SHA-256 of payload at 65535/65536/65537', async () => {
|
|||||||
const nonce = hexToBytes('0000000000000000000000000000000000000000000000000000000000000001')
|
const nonce = hexToBytes('0000000000000000000000000000000000000000000000000000000000000001')
|
||||||
|
|
||||||
async function sha256hex(data: Uint8Array): Promise<string> {
|
async function sha256hex(data: Uint8Array): Promise<string> {
|
||||||
const hash = await crypto.subtle.digest('SHA-256', data)
|
return bytesToHex(sha256(data))
|
||||||
return bytesToHex(new Uint8Array(hash))
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const vectors = [
|
const vectors = [
|
||||||
|
|||||||
Reference in New Issue
Block a user