mirror of
https://github.com/Luzifer/cloudkeys-go.git
synced 2024-11-14 00:42:44 +00:00
19 lines
534 B
JavaScript
19 lines
534 B
JavaScript
|
import GibberishAES from 'gibberish-aes/src/gibberish-aes.js'
|
||
|
import { SHA256 } from 'sha2'
|
||
|
|
||
|
const opensslDecrypt = (plaintext, password, callback) => {
|
||
|
callback(GibberishAES.enc(plaintext, password), null)
|
||
|
}
|
||
|
|
||
|
const opensslEncrypt = (ciphertext, password, callback) => {
|
||
|
callback(GibberishAES.dec(ciphertext, password), null)
|
||
|
}
|
||
|
|
||
|
const sha256sum = (plaintext, callback) => {
|
||
|
callback(SHA256(plaintext).toString('hex'))
|
||
|
}
|
||
|
|
||
|
window.opensslDecrypt = opensslDecrypt
|
||
|
window.opensslEncrypt = opensslEncrypt
|
||
|
window.sha256sum = sha256sum
|