Last active
December 27, 2019 20:10
-
-
Save kristopherjohnson/931963de4dbb261fb24914817a945988 to your computer and use it in GitHub Desktop.
Decoding the "binary codes" on a beer glass gift
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
#include <iostream> | |
int main() | |
{ | |
static const char codes[] = { | |
0b01101001, | |
0b01101100, | |
0b01101111, | |
0b01110110, | |
0b01100101, | |
0b01111001, | |
0b01101111, | |
0b01110101, | |
0 | |
}; | |
std::cout << codes << std::endl; | |
return 0; | |
} | |
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
2 base ! | |
align here | |
01101001 c, | |
01101100 c, | |
01101111 c, | |
01110110 c, | |
01100101 c, | |
01111001 c, | |
01101111 c, | |
01110101 c, | |
here over - chars type cr | |
bye |
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
codes = [ | |
0b01101001, | |
0b01101100, | |
0b01101111, | |
0b01110110, | |
0b01100101, | |
0b01111001, | |
0b01101111, | |
0b01110101 | |
] | |
chars = (chr(c) for c in codes) | |
print("".join(chars)) |
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
import Foundation | |
let codes: [UInt8] = [ | |
0b01101001, | |
0b01101100, | |
0b01101111, | |
0b01110110, | |
0b01100101, | |
0b01111001, | |
0b01101111, | |
0b01110101 | |
] | |
if let s = String(bytes: codes, encoding: .ascii) { | |
print(s) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
My wife gave me this beer glass as a Christmas gift. She wondered if I knew how to "read binary codes". I guessed what the message was, but decided to write a little Python program to verify it. And then for no good reason I also wrote the program in Swift, in C++, and in Forth.
The message is "iloveyou"