Created
July 14, 2020 03:52
-
-
Save mpyne-navy/ca7756c0eb21bc3eb5c60d3b2f163a10 to your computer and use it in GitHub Desktop.
Attacks the puzzle at https://twitter.com/senatorshoshana/status/1282865567985270785, poorly
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
#!/usr/bin/env perl | |
use 5.018; | |
use utf8; | |
use charnames (); | |
use Unicode::Normalize; | |
use strict; | |
use warnings; | |
# https://twitter.com/senatorshoshana/status/1282865567985270785 | |
# The emojis are images, not actual characters, but it appears possible | |
# to use the image name to figure out what Unicode character they are | |
# supposed to be | |
# | |
# To easily generate the list, use Chrome DevTools to inspect one of the | |
# emoji, right-click the <div> in the Elements view that contains all the <span> | |
# tags (each representing an emoji), and choose 'Store as Global Variable'. | |
# Then run this in the Javascript console: | |
# Array.from(temp1.querySelectorAll('span img')).map((el) => el.attributes.src.value); | |
my @emojis = ( | |
"https://abs-0.twimg.com/emoji/v2/svg/1f60b.svg", | |
"https://abs-0.twimg.com/emoji/v2/svg/1f417.svg", | |
"https://abs-0.twimg.com/emoji/v2/svg/1f346.svg", | |
"https://abs-0.twimg.com/emoji/v2/svg/1f3ea.svg", | |
"https://abs-0.twimg.com/emoji/v2/svg/1f9f1.svg", | |
"https://abs-0.twimg.com/emoji/v2/svg/1f38e.svg", | |
"https://abs-0.twimg.com/emoji/v2/svg/1f619.svg", | |
"https://abs-0.twimg.com/emoji/v2/svg/1f3e8.svg", | |
"https://abs-0.twimg.com/emoji/v2/svg/1f94e.svg", | |
"https://abs-0.twimg.com/emoji/v2/svg/1f397.svg", | |
"https://abs-0.twimg.com/emoji/v2/svg/1f6af.svg", | |
"https://abs-0.twimg.com/emoji/v2/svg/1f1e7-1f1ec.svg", | |
"https://abs-0.twimg.com/emoji/v2/svg/1f460.svg", | |
"https://abs-0.twimg.com/emoji/v2/svg/1f955.svg", | |
"https://abs-0.twimg.com/emoji/v2/svg/1f95c.svg", | |
"https://abs-0.twimg.com/emoji/v2/svg/1f6af.svg", | |
"https://abs-0.twimg.com/emoji/v2/svg/27a1.svg", | |
"https://abs-0.twimg.com/emoji/v2/svg/1f3ab.svg", | |
"https://abs-0.twimg.com/emoji/v2/svg/1f38d.svg", | |
"https://abs-0.twimg.com/emoji/v2/svg/1f954.svg", | |
"https://abs-0.twimg.com/emoji/v2/svg/1f351.svg", | |
"https://abs-0.twimg.com/emoji/v2/svg/1f37d.svg", | |
"https://abs-0.twimg.com/emoji/v2/svg/1f1e7-1f1ec.svg", | |
"https://abs-0.twimg.com/emoji/v2/svg/1f6c5.svg", | |
"https://abs-0.twimg.com/emoji/v2/svg/21a9.svg", | |
"https://abs-0.twimg.com/emoji/v2/svg/1f5bc.svg", | |
); | |
# Form the emoji string by converting all the Unicode code points to Unicode | |
# characters and then joining the characters into a single string. The | |
# Bulgarian flag "1f1e7-1f1ec" is a combined character so needed a bit of | |
# special handling. | |
my $uni_str = join('', map { | |
s(^.*/) (); # Remove everything up to final / | |
s(\.svg$)(); # Remove .svg | |
my @chars = split('-', $_); | |
(@chars > 1) | |
? join('', map { charnames::string_vianame("U+$_") } @chars) | |
: charnames::string_vianame("U+$_"); | |
} @emojis); | |
# Handle in explicitly denormalized mode | |
my $zzz_str = NFD($uni_str); | |
binmode(STDOUT, ":utf8"); | |
say "Your string is: $zzz_str"; | |
# Now let's loop through each character and see what it's formal Unicode name | |
# is | |
my @first_letters; | |
for my $char (split ('', $zzz_str)) { | |
my $uni_name = charnames::viacode(ord($char)); | |
say "$char is $uni_name"; | |
push @first_letters, substr($uni_name, 0, 1); | |
} | |
say "First letters: ", join('', @first_letters); | |
# This all gives me | |
# Your string is: ππππͺπ§±πππ¨π₯ππ―π§π¬π π₯π₯π―β‘π«ππ₯ππ½π§π¬π β©πΌ | |
# π is FACE SAVOURING DELICIOUS FOOD | |
# π is BOAR | |
# π is AUBERGINE | |
# πͺ is CONVENIENCE STORE | |
# 𧱠is BRICK | |
# π is JAPANESE DOLLS | |
# π is KISSING FACE WITH SMILING EYES | |
# π¨ is HOTEL | |
# π₯ is SOFTBALL | |
# π is REMINDER RIBBON | |
# π― is DO NOT LITTER SYMBOL | |
# π§ is REGIONAL INDICATOR SYMBOL LETTER B | |
# π¬ is REGIONAL INDICATOR SYMBOL LETTER G | |
# π is HIGH-HEELED SHOE | |
# π₯ is CARROT | |
# π₯ is PEANUTS | |
# π― is DO NOT LITTER SYMBOL | |
# β‘ is BLACK RIGHTWARDS ARROW | |
# π« is TICKET | |
# π is PINE DECORATION | |
# π₯ is POTATO | |
# π is PEACH | |
# π½ is FORK AND KNIFE WITH PLATE | |
# π§ is REGIONAL INDICATOR SYMBOL LETTER B | |
# π¬ is REGIONAL INDICATOR SYMBOL LETTER G | |
# π is LEFT LUGGAGE | |
# β© is LEFTWARDS ARROW WITH HOOK | |
# πΌ is FRAME WITH PICTURE | |
# First letters: FBACBJKHSRDRRHCPDBTPPPFRRLLF | |
# | |
# Which, combine the REGIONAL INDICATOR stuff (BG) from RR into just R | |
# since that's a bug of this script... but that still doesn't help me | |
# crack the code. | |
# That gives FBACBJKHSRDRHCPDBTPPPFRLLF |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment