aboutsummaryrefslogtreecommitdiff
path: root/challenge-162/duncan-c-white/README
blob: 4b5c1a964f9a57dc2c4d054580bd08abe85a770d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
TASK #1 - ISBN-13

Write a script to generate the check digit of given ISBN-13 code. Please
refer to

https://en.wikipedia.org/wiki/ISBN#ISBN-13_check_digit_calculation

for more information.  In summary, take each of the first 12 digits of
an ISBN code, from left to right, multiple 1st, 3rd, 5th etc by 1, and
the 2nd, 4th, 6th etc by 3, sum the result.  Mod 10 the sum.  Subtract
the sum from 10.  Mod 10 the result.

Example

ISBN-13 check digit for '978-0-306-40615-7' is 7.

MY NOTES: ok.  Pretty easy.

GUEST LANGUAGE: As a bonus, I also had a go at translating ch-1.pl into C,
look in the C directory for that.


TASK #2 - Wheatstone-Playfair

Implement encryption and decryption using the Wheatstone-Playfair cipher:

https://en.wikipedia.org/wiki/Playfair_cipher

Examples:

(These combine I and J, and use X as padding.)

encrypt("playfair example", "hide the gold in the tree stump") = "bmodzbxdnabekudmuixmmouvif"

decrypt("perl and raku", "siderwrdulfipaarkcrw") = "thewexeklychallengex"

MY NOTES: hmmm.  Not too hard.