Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/pigri/cf-workers-hash
Hash function for Cloudflare Workers
https://github.com/pigri/cf-workers-hash
cf cloudflare cloudflare-workers crypto hash hasher
Last synced: 3 months ago
JSON representation
Hash function for Cloudflare Workers
- Host: GitHub
- URL: https://github.com/pigri/cf-workers-hash
- Owner: pigri
- License: apache-2.0
- Created: 2024-03-15T10:46:33.000Z (11 months ago)
- Default Branch: main
- Last Pushed: 2024-10-29T20:21:31.000Z (3 months ago)
- Last Synced: 2024-10-29T22:47:37.696Z (3 months ago)
- Topics: cf, cloudflare, cloudflare-workers, crypto, hash, hasher
- Language: TypeScript
- Homepage: https://github.com/pigri/cf-workers-hash
- Size: 182 KB
- Stars: 8
- Watchers: 2
- Forks: 1
- Open Issues: 11
-
Metadata Files:
- Readme: README.md
- License: LICENSE
- Security: SECURITY.md
Awesome Lists containing this project
README
# Hash functions for Cloudflare Workers
[![NPM](https://nodei.co/npm/cf-workers-hash.png?stars&downloads)](https://nodei.co/npm/cf-workers-hash/)
![GitHub CI](https://github.com/pigri/cf-workers-hash/actions/workflows/test.yaml/badge.svg)
![NPM Publish](https://github.com/pigri/cf-workers-hash/actions/workflows/publish.yaml/badge.svg)
### What is this?
This is a simple hash function library for Cloudflare Workers. It supports the following hash functions:
- SHA-1 [WEBCRYPTO SUPPORTED](https://developers.cloudflare.com/workers/runtime-apis/web-crypto/)
- SHA-256 [WEBCRYPTO SUPPORTED](https://developers.cloudflare.com/workers/runtime-apis/web-crypto/)
- SHA-384 [WEBCRYPTO SUPPORTED](https://developers.cloudflare.com/workers/runtime-apis/web-crypto/)
- SHA-512 [WEBCRYPTO SUPPORTED](https://developers.cloudflare.com/workers/runtime-apis/web-crypto/)
- MD5 [WEBCRYPTO SUPPORTED](https://developers.cloudflare.com/workers/runtime-apis/web-crypto/)
- BASE64 / BASE64-DECODE
- XXHASH32
- XXHASH64
- BCRYPT / BCRYPT-COMPARE
- WHIRLPOOL / WHIRLPOOL-DECODE
- SHA3-224
- SHA3-256
- SHA3-384
- SHA3-512
- KECCAK224
- KECCAK256
- KECCAK384
- KECCAK512
- MD6
- CRC32
- CRC32C### How to install?
```
npm install cf-workers-hash
```### How to use?
Check the `example` directory.
```
import { sha1, sha256, sha384, sha512, base64, base64Decode, md5, xxhash64, xxhash32, bcrypt, bcryptCompare, whirlpool, whirlpoolDecode, sha3_512, sha3_224, sha3_256, sha3_384, keccak512, keccak384, keccak256, keccak224, md6, crc32, crc32c } from 'cf-workers-hash';
await sha1('test');
```### How to test in local?
```
npm test
```