Skip to content

Instantly share code, notes, and snippets.

@kristopherjohnson
Last active December 27, 2019 20:10
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kristopherjohnson/931963de4dbb261fb24914817a945988 to your computer and use it in GitHub Desktop.
Save kristopherjohnson/931963de4dbb261fb24914817a945988 to your computer and use it in GitHub Desktop.
Decoding the "binary codes" on a beer glass gift
#include <iostream>
int main()
{
static const char codes[] = {
0b01101001,
0b01101100,
0b01101111,
0b01110110,
0b01100101,
0b01111001,
0b01101111,
0b01110101,
0
};
std::cout << codes << std::endl;
return 0;
}
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
codes = [
0b01101001,
0b01101100,
0b01101111,
0b01110110,
0b01100101,
0b01111001,
0b01101111,
0b01110101
]
chars = (chr(c) for c in codes)
print("".join(chars))
import Foundation
let codes: [UInt8] = [
0b01101001,
0b01101100,
0b01101111,
0b01110110,
0b01100101,
0b01111001,
0b01101111,
0b01110101
]
if let s = String(bytes: codes, encoding: .ascii) {
print(s)
}
@kristopherjohnson
Copy link
Author

kristopherjohnson commented Dec 27, 2019

beer_glass

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"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment