Created
March 5, 2015 19:45
-
-
Save kumavis/2a34b865c8ef504f722b to your computer and use it in GitHub Desktop.
This file contains hidden or 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
start (secret) -> return apiObject with [encrypt, decrypt] with plaintext secret stored in closure | |
encrypt (input) -> generate salt, iv, additionalData, -> generate hash from salt and secret -> generate key from hash -> encrypt with key -> return json string with salt, iv, additionalData, and encrypted data (edited) | |
decrypt(input) -> read salt, iv, additionalData -> generate hash from salt and secret -> generate key from hash -> decrypt with key -> return unecrypted data | |
and the 'encrypted text' includes plaintext metadata about the encryption settings (salt, iv, additionalData) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment