Last active
April 2, 2018 21:49
-
-
Save awwong1/496c552fe149786f78db5f612d976f9a to your computer and use it in GitHub Desktop.
Circle of Trust
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// https://www.reddit.com/r/CircleofTrust/comments/8950o3/hash/ | |
var encryptedPassword = new Uint8Array([254, 49, 107, 19, 58, 24, 210, 3, 23, 245, 223, 217, 18, 231, 130, 33, 66, 77, 106, 50, 105, 143, 0, 149, 128, 242, 29, 251, 207, 11, 223, 127, 128, 2, 167, 235, 206, 26, 240, 155, 205, 240, 9, 216, 213, 196, 253, 156, 141, 156, 97, 35, 179, 248, 109, 0, 249, 92, 215, 58, 246, 73, 110, 0, 79, 201]); | |
var initializationVector = new Uint8Array([137, 244, 179, 47, 179, 29, 74, 151, 160, 85, 68, 111]); | |
var rawKey = JSON.parse("{\"alg\":\"A256GCM\",\"ext\":true,\"k\":\"gMjbMslfSKYPRDc-HJKqWrZ17tL5r97QUja62OG-944\",\"key_ops\":[\"encrypt\",\"decrypt\"],\"kty\":\"oct\"}"); | |
window.crypto.subtle.importKey( | |
"jwk", | |
rawKey, | |
{ name: "AES-GCM", }, | |
false, | |
["encrypt", "decrypt"] | |
) | |
.then(function(key){ | |
window.crypto.subtle.decrypt( | |
{ | |
name: "AES-GCM", | |
iv: initializationVector, | |
tagLength: 128, | |
}, | |
key, | |
encryptedPassword | |
) | |
.then(function(decrypted){ | |
console.log("The password is: " + new TextDecoder("utf-8").decode(decrypted)); | |
}) | |
.catch(function(err){ | |
console.error(err); | |
}); | |
}) | |
.catch(function(err){ | |
console.error(err); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment