mirror of
https://github.com/signalapp/Signal-Desktop.git
synced 2025-12-24 12:19:41 +00:00
Lilia's Webcrypto branch rebased and a few very tiny tweaks
This commit is contained in:
15
js/crypto.js
Normal file
15
js/crypto.js
Normal file
@@ -0,0 +1,15 @@
|
||||
function HmacSHA256(key, input) {
|
||||
return window.crypto.subtle.sign({name: "HMAC", hash: "SHA-256"}, key, input);
|
||||
}
|
||||
|
||||
function encryptAESCTR(input, key, counter) {
|
||||
return window.crypto.subtle.encrypt({name: "AES-CTR", counter: counter}, key, input);
|
||||
}
|
||||
|
||||
function decryptAESCTR(input, key, counter) {
|
||||
return window.crypto.subtle.decrypt({name: "AES-CTR", counter: counter}, key, input);
|
||||
}
|
||||
|
||||
function decryptAESCBC(input, key, iv) {
|
||||
return window.crypto.subtle.decrypt({name: "AES-CBC", iv: iv}, key, input);
|
||||
}
|
||||
Reference in New Issue
Block a user