Update docs for convenience hash functions
This commit is contained in:
parent
0a1da22fb4
commit
4944e736ee
@ -1,5 +1,10 @@
|
||||
# CHANGELOG
|
||||
|
||||
## 0.23.1 (unreleased)
|
||||
|
||||
- @cosmjs/crypto: Export new convenience functions `keccak256`, `ripemd160`,
|
||||
`sha1`, `sha256` and `sha512`.
|
||||
|
||||
## 0.23.0 (2020-10-09)
|
||||
|
||||
- @cosmjs/cli: Expose `HdPath` type.
|
||||
|
||||
@ -25,6 +25,7 @@ export class Keccak256 implements HashFunction {
|
||||
}
|
||||
}
|
||||
|
||||
/** Convenience function equivalent to `new Keccak256(data).digest()` */
|
||||
export function keccak256(data: Uint8Array): Uint8Array {
|
||||
return new Keccak256(data).digest();
|
||||
}
|
||||
|
||||
@ -23,6 +23,7 @@ export class Ripemd160 implements HashFunction {
|
||||
}
|
||||
}
|
||||
|
||||
/** Convenience function equivalent to `new Ripemd160(data).digest()` */
|
||||
export function ripemd160(data: Uint8Array): Uint8Array {
|
||||
return new Ripemd160(data).digest();
|
||||
}
|
||||
|
||||
@ -26,6 +26,7 @@ export class Sha1 implements HashFunction {
|
||||
}
|
||||
}
|
||||
|
||||
/** Convenience function equivalent to `new Sha1(data).digest()` */
|
||||
export function sha1(data: Uint8Array): Uint8Array {
|
||||
return new Sha1(data).digest();
|
||||
}
|
||||
@ -53,6 +54,7 @@ export class Sha256 implements HashFunction {
|
||||
}
|
||||
}
|
||||
|
||||
/** Convenience function equivalent to `new Sha256(data).digest()` */
|
||||
export function sha256(data: Uint8Array): Uint8Array {
|
||||
return new Sha256(data).digest();
|
||||
}
|
||||
@ -80,6 +82,7 @@ export class Sha512 implements HashFunction {
|
||||
}
|
||||
}
|
||||
|
||||
/** Convenience function equivalent to `new Sha512(data).digest()` */
|
||||
export function sha512(data: Uint8Array): Uint8Array {
|
||||
return new Sha512(data).digest();
|
||||
}
|
||||
|
||||
1
packages/crypto/types/keccak.d.ts
vendored
1
packages/crypto/types/keccak.d.ts
vendored
@ -6,4 +6,5 @@ export declare class Keccak256 implements HashFunction {
|
||||
update(data: Uint8Array): Keccak256;
|
||||
digest(): Uint8Array;
|
||||
}
|
||||
/** Convenience function equivalent to `new Keccak256(data).digest()` */
|
||||
export declare function keccak256(data: Uint8Array): Uint8Array;
|
||||
|
||||
1
packages/crypto/types/ripemd.d.ts
vendored
1
packages/crypto/types/ripemd.d.ts
vendored
@ -6,4 +6,5 @@ export declare class Ripemd160 implements HashFunction {
|
||||
update(data: Uint8Array): Ripemd160;
|
||||
digest(): Uint8Array;
|
||||
}
|
||||
/** Convenience function equivalent to `new Ripemd160(data).digest()` */
|
||||
export declare function ripemd160(data: Uint8Array): Uint8Array;
|
||||
|
||||
3
packages/crypto/types/sha.d.ts
vendored
3
packages/crypto/types/sha.d.ts
vendored
@ -6,6 +6,7 @@ export declare class Sha1 implements HashFunction {
|
||||
update(data: Uint8Array): Sha1;
|
||||
digest(): Uint8Array;
|
||||
}
|
||||
/** Convenience function equivalent to `new Sha1(data).digest()` */
|
||||
export declare function sha1(data: Uint8Array): Uint8Array;
|
||||
export declare class Sha256 implements HashFunction {
|
||||
readonly blockSize: number;
|
||||
@ -14,6 +15,7 @@ export declare class Sha256 implements HashFunction {
|
||||
update(data: Uint8Array): Sha256;
|
||||
digest(): Uint8Array;
|
||||
}
|
||||
/** Convenience function equivalent to `new Sha256(data).digest()` */
|
||||
export declare function sha256(data: Uint8Array): Uint8Array;
|
||||
export declare class Sha512 implements HashFunction {
|
||||
readonly blockSize: number;
|
||||
@ -22,4 +24,5 @@ export declare class Sha512 implements HashFunction {
|
||||
update(data: Uint8Array): Sha512;
|
||||
digest(): Uint8Array;
|
||||
}
|
||||
/** Convenience function equivalent to `new Sha512(data).digest()` */
|
||||
export declare function sha512(data: Uint8Array): Uint8Array;
|
||||
|
||||
Loading…
Reference in New Issue
Block a user