https://github.com/korywka/crypto-aes-gcm
Encrypt and decrypt text using AES-GCM
https://github.com/korywka/crypto-aes-gcm
aes-gcm crypto webcrypto
Last synced: 6 months ago
JSON representation
Encrypt and decrypt text using AES-GCM
- Host: GitHub
- URL: https://github.com/korywka/crypto-aes-gcm
- Owner: korywka
- Created: 2022-01-11T14:43:26.000Z (almost 4 years ago)
- Default Branch: master
- Last Pushed: 2023-09-30T11:53:20.000Z (about 2 years ago)
- Last Synced: 2025-05-02T12:58:21.014Z (6 months ago)
- Topics: aes-gcm, crypto, webcrypto
- Language: JavaScript
- Homepage:
- Size: 11.7 KB
- Stars: 12
- Watchers: 1
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# crypto-aes-gcm
Uses the SubtleCrypto interface of the Web Cryptography API to encrypt and decrypt text using AES-GCM (AES Galois counter mode).
This module uses the native WebCrypto API in [node.js](https://nodejs.org/api/webcrypto.html), Deno and the [browser](https://developer.mozilla.org/en-US/docs/Web/API/Web_Crypto_API).
Node and browser: [crypto-aes-gcm](https://www.npmjs.com/package/crypto-aes-gcm)
Deno package: [https://deno.land/x/crypto_aes_gcm](https://deno.land/x/crypto_aes_gcm)
```js
import { aes_gcm_encrypt, aes_gcm_decrypt } from 'crypto-aes-gcm';
const password = '123456';
const message = 'i will never let you go';
const encrypted = await aes_gcm_encrypt(message, password);
console.log(encrypted);
const decrypted = await aes_gcm_decrypt(encrypted, password);
console.log(decrypted);
console.log(message === decrypted);
```
## Original implementation
The code was originally written by [Chris Veness](https://gist.github.com/chrisveness/43bcda93af9f646d083fad678071b90a).