mirror of
https://github.com/fluencelabs/js-libp2p-crypto
synced 2025-03-15 21:50:54 +00:00
26 lines
649 B
JavaScript
26 lines
649 B
JavaScript
/* eslint-env mocha */
|
|
'use strict'
|
|
|
|
const expect = require('chai').expect
|
|
|
|
const crypto = require('../src')
|
|
|
|
describe('keyStretcher', () => {
|
|
describe('generate', () => {
|
|
const ciphers = ['AES-128', 'AES-256', 'Blowfish']
|
|
const hashes = ['SHA1', 'SHA256']
|
|
const res = crypto.generateEphemeralKeyPair('P-256')
|
|
const secret = res.genSharedKey(res.key)
|
|
|
|
ciphers.forEach((cipher) => {
|
|
hashes.forEach((hash) => {
|
|
it(`${cipher} - ${hash}`, () => {
|
|
const keys = crypto.keyStretcher(cipher, hash, secret)
|
|
expect(keys.k1).to.exist
|
|
expect(keys.k2).to.exist
|
|
})
|
|
})
|
|
})
|
|
})
|
|
})
|