Skip to content

Commit

Permalink
feat: New hash algorithms and refactors
Browse files Browse the repository at this point in the history
  • Loading branch information
pigri committed Mar 15, 2024
1 parent 95bf388 commit eb6e798
Show file tree
Hide file tree
Showing 10 changed files with 1,799 additions and 49 deletions.
27 changes: 23 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,31 @@

## How to use?

### Hasher
[Available hash functions](https://developer.mozilla.org/en-US/docs/Web/API/SubtleCrypto/digest#algorithm)
Check the `example` directory.

### Supported hash functions
- SHA-1
- SHA-256
- SHA-384
- SHA-512
- MD5
- BASE64
- XXHASH32
- XXHASH64
- BCRYPT / BCRYPT-COMPARE
- WHIRLPOOL
- SHA3-224
- SHA3-256
- SHA3-384
- SHA3-512
- KECCAK224
- KECCAK256
- KECCAK384
- KECCAK512

```
import { hasher } from 'cf-workers-hash';
await hasher('test', 'SHA-256');
import { sha1, sha256, sha384, sha512, base64, md5, xxhash64, xxhash32, bcrypt, bcryptCompare, whirlpool, sha3_512, sha3_224, sha3_256, sha3_384, keccak512, keccak384, keccak256, keccak224 } from 'cf-workers-hash';
await sha1('test');
```

### How to test in local?
Expand Down
6 changes: 1 addition & 5 deletions example/package.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"name": "cf-worker-hash-example",
"name": "cf-workers-hash-example",
"scripts": {
"dev": "wrangler dev"
},
Expand All @@ -13,10 +13,6 @@
"typescript": "5.4.2",
"wrangler": "3.34.2"
},
"dependencies": {
"itty-fetcher": "0.9.4",
"itty-router": "4.2.1"
},
"engines": {
"node": ">=18",
"pnpm": ">=8"
Expand Down
Loading

0 comments on commit eb6e798

Please sign in to comment.