Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/aviate-labs/crypto.mo
Crypto Package for Motoko
https://github.com/aviate-labs/crypto.mo
aes hash hmac sha224 sha256
Last synced: 3 months ago
JSON representation
Crypto Package for Motoko
- Host: GitHub
- URL: https://github.com/aviate-labs/crypto.mo
- Owner: aviate-labs
- License: apache-2.0
- Created: 2021-11-09T08:55:47.000Z (about 3 years ago)
- Default Branch: main
- Last Pushed: 2023-03-15T16:08:12.000Z (over 1 year ago)
- Last Synced: 2024-04-19T01:33:15.510Z (7 months ago)
- Topics: aes, hash, hmac, sha224, sha256
- Language: Motoko
- Homepage:
- Size: 70.3 KB
- Stars: 11
- Watchers: 2
- Forks: 4
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- awesome-motoko - motoko-SHA - SHA224 and SHA256 hash algorithms as defined in FIPS 180-4. (Libraries / Cryptography)
README
# Crypto Package for Motoko
## Packages
| Package Name | Description | Spec | Path |
|--------------|-------------|------|------|
| SHA | SHA224 and SHA256 hash algorithms | FIPS 180-4 | `crypto/SHA/..` |
| AES | Advanced Encryption Standard (AES) | FIPS 197 | `crypto/AES` |
| HMAC | Keyed-Hash Message Authentication Code (HMAC) | FIPS 198-1 | `crypto/HMAC` |## Usage
### SHA
```motoko
SHA256.sum(Blob.toArray(Text.encodeUtf8("hello world\n"));
// "a948904f2f0f479b8f8197694b30184b0d2ed1c1cd2a1ec0fb85d299a192a447"let h = SHA256.New();
h.write(Blob.toArray(Text.encodeUtf8("hello world\n")));
h.sum([]);
// "a948904f2f0f479b8f8197694b30184b0d2ed1c1cd2a1ec0fb85d299a192a447"
```### HMAC
```motoko
let h = HMAC.New(SHA256.New, []);
h.write(Blob.toArray(Text.encodeUtf8("hello world\n")));
h.sum([]);
// "d4452dbfe1fe25bf6c2fa79172dae3d7e2950de69f76e6c23188c49bfba4372f"
```