Update docs for convenience hash functions

This commit is contained in:
willclarktech 2020-10-13 13:02:38 +02:00
parent 0a1da22fb4
commit 4944e736ee
No known key found for this signature in database
GPG Key ID: 551A86E2E398ADF7
7 changed files with 15 additions and 0 deletions

View File

@ -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.

View File

@ -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();
}

View File

@ -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();
}

View File

@ -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();
}

View File

@ -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;

View File

@ -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;

View File

@ -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;