Files
common/packages/util-crypto/src/nacl/deriveHard.ts
T
Jaco Greeff 5dc8e87797 Hard and soft derivation aligned with substrate master (#369)
* I compiles... ship it!?

* Re-enable derivation from path tests

* Update schnorrkel-js (latest w3f version)

* Swap default keyring to sr25519
2019-03-16 11:34:31 +01:00

16 lines
535 B
TypeScript

// Copyright 2017-2019 @polkadot/util-crypto authors & contributors
// This software may be modified and distributed under the terms
// of the Apache-2.0 license. See the LICENSE file for details.
import { compactAddLength, stringToU8a, u8aConcat } from '@polkadot/util';
import blake2AsU8a from '../blake2/asU8a';
const HDKD = compactAddLength(stringToU8a('Ed25519HDKD'));
export default function deriveHard (seed: Uint8Array, chainCode: Uint8Array): Uint8Array {
return blake2AsU8a(
u8aConcat(HDKD, seed, chainCode)
);
}