elmbridge / curriculum

Curriculum for Elmbridge
https://elmbridge.github.io/curriculum/
66 stars 14 forks source link

What is a "secret decoder ring"? #87

Closed siruguri closed 8 years ago

siruguri commented 8 years ago

This one's definitely culture-specific - I can tell you that because I'm a demmed furriner.

I understand the ring encodes a substitution cipher, but this line in the curriculum:

Of course! Like any good decoder ring, the EmojiConverter library uses a key to determine how to encode and decode messages

throws me off. I take it the "key" is basically a pair connecting one of the ciphered symbols to a plaintext symbol, that cipher and plaintext are both ordered sets, and that the key therefore tells you all the correspondences.

If so, shouldn't the first argument to textToEmoji be a pair, rather than just one Unicode character (an emoji)? That seems like the more intuitive guess, but my intuition might be off because I don't understand "decoder rings" :)

Reading the code to figure it out got a bit hairy for me...

siruguri commented 8 years ago

I looked at the code this morning a little longer ... I think the chosen emoji maps to a (ASCII code 97), am I right?

raorao commented 8 years ago

I looked at the code this morning a little longer ... I think the chosen emoji maps to a (ASCII code 97), am I right?

yup, that's totally right.

I totally understand if this reference is culturally-specific, and would love a suggested rewrite (either here or in a PR). a sentence or so explaining the logic of EmojiConverter would go a long way.

siruguri commented 8 years ago

I do have some thoughts on explaining the overall idea with the decoder a bit more in that section. I don't propose to explain EmojiConverter per se, because I think the concepts in it will complicate matters at this stage, but to outline broadly what approach the code is trying to take, and also use that opportunity to explain the point of "decoder rings."

raorao commented 8 years ago

yup, totally! a PR would be very welcome!

On Wed, Oct 19, 2016 at 8:38 PM Sameer S notifications@github.com wrote:

I do have some thoughts on explaining the overall idea with the decoder a bit more in that section. I don't propose to explain EmojiConverter per se, because I think the concepts in it will complicate matters at this stage, but to outline broadly what approach the code is trying to take, and also use that opportunity to explain the point of "decoder rings."

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/elmbridge/curriculum/issues/87#issuecomment-255001232, or mute the thread https://github.com/notifications/unsubscribe-auth/AASEtGioFrkR6fqlIVMpVfzGl74XfXETks5q1uJEgaJpZM4Kaa_L .

avh4 commented 8 years ago

FYI, I'm adding the following paragraph in a PR I'm making right now:

(In the style of [secret decoder rings], EmojiConverter implements a simple [substitution cipher] that works by replacing all the letters in a message with the corresponding letter in a shifted alphabet. A shared, secret value (called the "key") determines how much shifting occurs, and the original message can later be recovered if the key is known.)

avh4 commented 8 years ago

See https://github.com/elmbridge/curriculum/pull/94

raorao commented 8 years ago

closing, as this is resolved. feel free to reopen @siruguri if you feel otherwise.

siruguri commented 8 years ago

if you don't mind, I'll work atop of what you've already written, and maybe reference this but not re-open for now.

On Fri, Oct 21, 2016 at 2:32 PM, Srinivas Rao notifications@github.com wrote:

closing, as this is resolved. feel free to reopen @siruguri https://github.com/siruguri if you feel otherwise.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/elmbridge/curriculum/issues/87#issuecomment-255470333, or mute the thread https://github.com/notifications/unsubscribe-auth/AACezeECYubEoRbGsUA6FlXyJpFGWdvaks5q2S9UgaJpZM4Kaa_L .