1
0
Fork 0
mirror of https://github.com/Luzifer/cloudkeys-go.git synced 2024-11-14 00:42:44 +00:00
cloudkeys-go/src/js_cryptocore.js

19 lines
534 B
JavaScript
Raw Normal View History

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