mirror of
https://github.com/Luzifer/cloudkeys-go.git
synced 2024-11-12 16:02:44 +00:00
18 lines
534 B
JavaScript
18 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
|