Created
December 17, 2018 17:25
-
-
Save kylemccollom/7c3b6c67063af138d7e361329590c36c to your computer and use it in GitHub Desktop.
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
// encryption | |
const padding = calculatePadding(data); | |
const encryptedMemo = encrypt(data + padding + padding.length, secretKey) | |
.toString('hex'); | |
const memo = StellarSdk.Memo.hash(encryptedMemo); | |
// decryption | |
const decryptedMemo = decrypt(memo.value, secretKey); | |
const paddingSize = decryptedMemo.last(); | |
const originalData = decryptedMemo.remove(paddingSize + 1); | |
// remove the padding + the extra character used to store the padding size |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment