adapap

Jumping Chain Hash Documentation

Dec 26th, 2017
136
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.61 KB | None | 0 0
  1. Jim's Jumping Chain Hash (JCH) involves taking a string of lowercase letters and encrypting it by adding chains to both sides of the original input. *Jim is looking for his password, so once you understand how the password is encrypted, you will have to reverse the process!*
  2.  
  3. For our example, let's say the input is the string: 'ctf'
  4. This initial input will be referred to as the "block", because it does not move throughout the process.
  5.  
  6. There are two types of jumps used to add to the block: inner jumps and outer jumps. For simplicity, we will use all letters added to the left as the left chain, and to the right as the right chain. The chain will always start as an inner chain, and toggles for every round of the JCH.
  7.  
  8. Since we start on the inner jump, this means that we will add the new letters to the end of our left chain and to the beginning of our right chain. An outer jump is the opposite: add to the beginning of the left chain, and to the end of the right chain. For the left chain, each letter that is added is simply the alpha value of the block (a-z corresponds to 0-25), decreased by 1 if it is an inner jump and increased by 1 if it is an outer jump. The right chain is just the reverse: increase by 1 if it is an outer jump, but decrease by 1 if it is an inner jump. This is much easier to visualize than to explain, so here is our example.
  9.  
  10. Our block will be wrapped in brackets like so: [ctf]
  11. Since our block has a length of 3, we will perform these jumps 3 times in total. After each jump, the letters in the block are modified (explained later). For our first jump, which is always an inner jump, we will take each letters alpha value and subtract 1 for the left chain. If it becomes -1, it loops around to 25 (a becomes z).
  12. Our left chain added to our block looks like this: bse[ctf]
  13. The right chain consists of 1 added to each letter, with the same looping principle applied (z becomes a). Keep in mind that in this case, it is adding each letter to the beginning of the right chain (it looks as though it is in reverse order, but it is not).
  14. Our result consists of the left chain, the block, and the right chain: bse[ctf]gud
  15.  
  16. The block is now modified in this way: Take the sums of the alpha values in the left chain and right chain, and multiply them together. The product = (1 + 18 + 4) * (3 + 20 + 6) = 667. For each letter in the block, add this product value (667) to its alpha value, and take % 26 to keep it within the alpha range. The new letter is the alpha letter of that value. [ctf] becomes [tkw].
  17.  
  18. Now we switch to the outer jump. This time, the rules for the left and right switch. Think of it as adding to the outside of the overall chain: we add to the beginning of the left, and the end of the right. If we follow the chain rules correctly and adjust the block value, our result is the following:
  19. xlubse[lco]gudsjv
  20.  
  21. One more round of the JCH, and our final result is our encrypted value:
  22. xlubsekbn[dug]pdmgudsjv --> xlubsekbndugpdmgudsjv
  23.  
  24. This means that the decrypted value of our result ('xlubsekbndugpdmgudsjv') gives us 'ctf'.
  25.  
  26. Jim is losing bitcoin as we speak! Go and decrypt his bitcoin account password (but please don't steal his bitcoin...)
  27.  
  28. [Additional Test Cases]
  29. decrypted <--> encrypted
  30. ========================
  31. pumpkin <--> idfkhpkqlnspxsidfkhpkotlojhmmrjmhfkchzcxvamrjmhfkrwormkpmhjoltocxzebjemhjoltoojlqnvqinfidbgqvnqljoinfidbg
  32. bitcoin <--> upvjapimhnbshaezftkzsahsbnhmszktfzecjudpjoszktfzezgramglgbhvmbuqlrfwlegbhvmbuojpdujcqxirdxcyfqzlfkgnyhtns
  33. ctflearn <--> jnwahbpyjnwahbpyjnwahbpyzdmqxrfobsekdzqmjamslhyujamslhyujamslhyukbntmizvwajnuoclwajnuoclwajnuoclosbfmgudmdpvokbxwnzfyulhwnzfyulhwnzfyulh
Add Comment
Please, Sign In to add comment