Last active
November 8, 2021 11:05
-
-
Save JanWerder/a50f1113fde80dbdc78fc503fe767d20 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
| // Decodes a BOBF binary key to a HEX String | |
| decodeBOBFKey: function (str) { | |
| const raw = atob(str); | |
| let result = ''; | |
| for (let i = 0; i < raw.length; i++) { | |
| const hex = raw.charCodeAt(i).toString(16); | |
| result += (hex.length === 2 ? hex : '0' + hex); | |
| } | |
| return result.toUpperCase(); | |
| } | |
| //Example: base64ToHex("AFBWuTv8HtuFpXoO4hsXtQ==") --> '005056B93BFC1EDB85A57A0EE21B17B5' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment