From 2e15bb28bca4e0976e339158b69132ff99290a4b Mon Sep 17 00:00:00 2001 From: Vivian Dai <38384400+vivian-dai@users.noreply.github.com> Date: Tue, 7 Sep 2021 13:15:56 -0400 Subject: [PATCH 1/2] Added My Friend John - Miscellaneous --- Miscellaneous/My Friend John/MyFriendJohn.zip | Bin 0 -> 1331 bytes Miscellaneous/My Friend John/README.md | 21 ++++++++++++++++++ 2 files changed, 21 insertions(+) create mode 100644 Miscellaneous/My Friend John/MyFriendJohn.zip create mode 100644 Miscellaneous/My Friend John/README.md diff --git a/Miscellaneous/My Friend John/MyFriendJohn.zip b/Miscellaneous/My Friend John/MyFriendJohn.zip new file mode 100644 index 0000000000000000000000000000000000000000..81219eb79f1e5d0d15dcdf6228baf64b29efd257 GIT binary patch literal 1331 zcmWIWW@h1H0D(K*=Y!%BCdAdVFff2HKZ6WIX>qD&OY(Ddb25ud z^hzp9zy>`QJ(&Q)Xa*T&7f5_@4rF=7w^pY(`*7YFZPf!AHtWh|XT0HoQP z!PDkCyANfI>)5j+{hO`+^o~5*X18Kzt&Txc6s{B=TkPn?e#t~A^ZK* zhTjU0!#v!2|DQXs_ddhCMY9&0x-su9_p!NX^(a0hF3qiceQNnKi)uw~-Mn|6KO7fX znOWFusEyd)JfVuWylUU8D^G5f&0VM?Tc3ZkI{tFyf;AUxBkbS4maWL)RFS(pBlDQh z>hr2E!&T>%PW`mMU{21@WQRC8_VUFgJR8d|Fz`+;c;jh#RrnHvt%Ido^hNEuty%5C zYv%?zRcSWc-t}H}>wM(0_m>N&T<{mxIQFcv;(|cs_U_MrzUU>1`ejuRq3%GGCo)^c1^dvWKg56{Az&A^lmF6OYAtN5NRe9y^_q)A!>^h~Vw$9Z#?r`nhy!*+P3cQ^&-^}>Nen@Et@9DU5!G%Ws z4EHXJfBM_Fg=MN#PCt(`hw#UbE*z{s+<%p^1}Jt186{n+y0*K<;P}27|FleGw?$Q5 zI}u>|ZJEc<)xokZK6f%AvJV9=ER|hu6l@SF&bTl1!_zBfJPOk`ylQc2(Tkt{W7;N- z+rk#>*WFnxbv(P*uAJprYnI^G1;W3@KkrIBnw=1yg9C9 z$Cv&2x6L8;>FFbG+y4H1nNZEo7a6WF@zVWuQ+{-?gddqboi}lc-}5(Tr~5RBoQ~4? z-<#fNBD1}C>E4wBd}sE@&$^VGc}n@0!_~LD)_BQ&I;mOOO Date: Sat, 11 Dec 2021 12:53:29 -0500 Subject: [PATCH 2/2] Added The Credit Card Fraudster - Programming --- .../The Credit Card Fraudster/README.md | 17 ++++++++++++ .../The Credit Card Fraudster/solve.py | 27 +++++++++++++++++++ 2 files changed, 44 insertions(+) create mode 100644 Programming/The Credit Card Fraudster/README.md create mode 100644 Programming/The Credit Card Fraudster/solve.py diff --git a/Programming/The Credit Card Fraudster/README.md b/Programming/The Credit Card Fraudster/README.md new file mode 100644 index 0000000..7a98d8c --- /dev/null +++ b/Programming/The Credit Card Fraudster/README.md @@ -0,0 +1,17 @@ +## The Credit Card Fraudster +The main idea is checking numbers in a given range against the Luhn algorithm + +#### Step-1: +Implement the Luhn algorithm which works like this: +1. Start from the least significant (right most) digit +2. Take the sum of the digits from right to left but double every second digit. If the digit doubled is greater than 10, take the sum of the digits on that doubled value +3. If the final value can divide evenly into 10, passes the Luhn check, otherwise it does not + +#### Step-2: +Now we need to get the range of numbers that fit the credit card number in the format of `543210******1234`. This would mean all numbers from `5432100000001234` to `5432109999991234` with an increment of `10000` + +#### Step-3: +Loop through all possible numbers, check if it's divisible by `123457` and passes the Luhn check. + +#### Step-4: +The flag is revealed after running the script. \ No newline at end of file diff --git a/Programming/The Credit Card Fraudster/solve.py b/Programming/The Credit Card Fraudster/solve.py new file mode 100644 index 0000000..7c1d92b --- /dev/null +++ b/Programming/The Credit Card Fraudster/solve.py @@ -0,0 +1,27 @@ +min_val = 5432100000001234 +max_val = 5432109999991234 +inc = 10000 + +def luhn_check(num): + def sum_of_digits(n): + s = str(n) + t = 0 + for c in s: + t += int(c) + return t + + string = str(num) + total = 0 + double = False + for i in range(len(string) - 1, -1, -1): + c = string[i] + if double: + total += int(c)*2 if int(c)*2 < 10 else sum_of_digits(int(c)*2) + else: + total += int(c) + double = not double + return total%10 == 0 + +for i in range(min_val, max_val, inc): + if i%123457 == 0 and luhn_check(i): + print(i) \ No newline at end of file