Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
function sign (signerPair: IKeyringPair, u8a: Uint8Array): Uint8Array {
const encoded = u8a.length > 256
? blake2AsU8a(u8a)
: u8a;
return signerPair.sign(encoded);
}
get hash (): Hash {
return new Hash(
blake2AsU8a(this.toU8a(), 256)
);
}
public get hash (): IHash {
return new Raw(this.registry, blake2AsU8a(this.toU8a(), 256));
}
public get hash (): IHash {
return new U8a(this.registry, blake2AsU8a(this.toU8a(), 256));
}
const blake2 = (value: Uint8Array): Uint8Array =>
blake2AsU8a(value, 512);
public get hash (): IHash {
return new Raw(this.registry, blake2AsU8a(this.toU8a(), 256));
}
public get hash (): IHash {
return createType(this.registry, 'Hash', blake2AsU8a(this.toU8a(), 256));
}
export function sign (signerPair: IKeyringPair, u8a: Uint8Array, options?: SignOptions): Uint8Array {
const encoded = u8a.length > 256
? blake2AsU8a(u8a)
: u8a;
return signerPair.sign(encoded, options);
}
isBlake2256: (data: HasherInput): Uint8Array => blake2AsU8a(data, 256),
isTwox128: (data: HasherInput): Uint8Array => xxhashAsU8a(data, 128),