mirror of
https://github.com/fluencelabs/libp2p-ts
synced 2025-03-16 02:00:50 +00:00
Add keccak
This commit is contained in:
parent
26cc286262
commit
dd1ba18e71
@ -10,3 +10,4 @@ This following libraries are currently included. Where possible add the relevant
|
||||
|
||||
- [blakejs](https://github.com/dcposch/blakejs)
|
||||
- [bn.js](https://github.com/indutny/bn.js/) [@types PR #26717](https://github.com/DefinitelyTyped/DefinitelyTyped/pull/26717)
|
||||
- [keccak](https://github.com/cryptocoinjs/keccak)
|
||||
|
20
keccak/index.d.ts
vendored
Normal file
20
keccak/index.d.ts
vendored
Normal file
@ -0,0 +1,20 @@
|
||||
// Type definitions for keccak 1.4.0
|
||||
// Project: https://github.com/cryptocoinjs/keccak
|
||||
// Definitions by: Jaco Greeff <https://github.com/jacogr>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
/// <reference types="node"/>
|
||||
|
||||
interface KeccakHasher {
|
||||
digest(): Buffer;
|
||||
update(message: string | Buffer): KeccakHasher;
|
||||
|
||||
_resetState(): void,
|
||||
_clone(): KeccakHasher
|
||||
}
|
||||
|
||||
type KeccakTypes = 'keccak224' | 'keccak256' | 'keccak384' | 'keccak512' | 'sha3-224' | 'sha3-256' | 'sha3-384' | 'sha3-512' | 'shake128' | 'shake256';
|
||||
|
||||
type keccak = (type: KeccakTypes) => KeccakHasher;
|
||||
|
||||
export = keccak;
|
7
keccak/keccak-tests.ts
Normal file
7
keccak/keccak-tests.ts
Normal file
@ -0,0 +1,7 @@
|
||||
import createKeccak = require('keccak');
|
||||
|
||||
const context = createKeccak('keccak256');
|
||||
|
||||
context.update(Buffer.from([1, 2, 3, 4, 5]));
|
||||
context.update('hello world');
|
||||
context.digest();
|
16
keccak/tsconfig.json
Normal file
16
keccak/tsconfig.json
Normal file
@ -0,0 +1,16 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"lib": ["es6"],
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictFunctionTypes": true,
|
||||
"strictNullChecks": true,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": ["../"],
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
},
|
||||
"files": ["index.d.ts", "bn.js-tests.ts"]
|
||||
}
|
1
keccak/tslint.json
Normal file
1
keccak/tslint.json
Normal file
@ -0,0 +1 @@
|
||||
{ "extends": "dtslint/dt.json" }
|
Loading…
x
Reference in New Issue
Block a user