Overclock.net › Forums › Software, Programming and Coding › Coding and Programming › Programming Challenge #10: Fun with cryptography
New Posts  All Forums:Forum Nav:

Programming Challenge #10: Fun with cryptography

post #1 of 36
Thread Starter 
Fun with cryptography

(Previous challenge: Programming Challenge 9: Writing a basic game)

Before you read on:
A huge disclaim needs to be made. NEVER EVER roll your own encryption ciphers. I can guarantee you that as smart and talented programmer as you may be, you will make a mistake somewhere that will leave your cipher vulnerable. The challenges here are just for fun. If anyone does have any questions about how securely encrypt data, then please feel free to ask.


How post your answers:
Do NOT post the complete decoded string because others might want to try the same challenge. Instead, post 1 word from the decoded string and it's word number. eg "word 2 = NOT" would be your reply if this paragraph was the answer. Also please post your source code inside [ code ] and [ spoiler ] tags as it keeps the thread tidy. eg:
Quote:
easy challenge: word 2 = NOT
[SPOILER=Source code, written in C#]
[CODE]
// code be here
[/CODE]
[/SPOILER]

Easy challenge:
In the spoiler below, I've encoded an extract from my favourite book. Each ASCII character has been incrimented by one. So the letter A -> B. Decode the string; but don't post the entire answer (see How post your answers above)
code (Click to show)
Gbs!pvu!jo!uif!vodibsufe!cbdlxbufst!pg!uif!vogbtijpobcmf!foe!pg!uif!xftufso!tqjsbm!bsn!pg!uif!Hbmbyz!mjft!b!tnbmm!vosfhbsefe!zfmmpx!tvo/!Pscjujoh!uijt!bu!b!ejtubodf!pg!spvhimz!ojofuz.uxp!njmmjpo!njmft!jt!bo!vuufsmz!jotjhojgjdbou!mjuumf!cmvf!hsffo!qmbofu!xiptf!bqf.eftdfoefe!mjgf!gpsnt!bsf!tp!bnb{johmz!qsjnjujwf!uibu!uifz!tujmm!uijol!ejhjubm!xbudift!bsf!b!qsfuuz!ofbu!jefb/


Medium challenge:
In the spoiler below, I've encoded an extract from my favourite book. Each ASCII character has been incrimented by one (so the letter A -> B) and then converted to hex. Decode the string but don't post the entire answer (see How post your answers above)
code (Click to show)
55-69-66-21-49-6a-75-64-69-2e-49-6a-6c-66-73-28-74-21-48-76-6a-65-66-21-75-70-21-75-69-66-21-48-62-6d-62-79-7a-21-62-6d-74-70-21-6e-66-6f-75-6a-70-6f-74-21-62-6d-64-70-69-70-6d-2f-21-4a-75-21-74-62-7a-74-21-75-69-62-75-21-75-69-66-21-63-66-74-75-21-65-73-6a-6f-6c-21-6a-6f-21-66-79-6a-74-75-66-6f-64-66-21-6a-74-21-75-69-66-21-51-62-6f-21-48-62-6d-62-64-75-6a-64-21-48-62-73-68-6d-66-21-43-6d-62-74-75-66-73-2d-21-75-69-66-21-66-67-67-66-64-75-21-70-67-21-78-69-6a-64-69-21-6a-74-21-6d-6a-6c-66-21-69-62-77-6a-6f-68-21-7a-70-76-73-21-63-73-62-6a-6f-74-21-74-6e-62-74-69-66-65-21-70-76-75-21-78-6a-75-69-21-62-21-74-6d-6a-64-66-21-70-67-21-6d-66-6e-70-6f-21-78-73-62-71-71-66-65-21-73-70-76-6f-65-21-62-21-6d-62-73-68-66-21-68-70-6d-65-21-63-73-6a-64-6c-2f

Hard challenge:
I've encoded an extract from my favourite book. I've used a symmetric-key stream cipher, the key is my user name. Use this to decode the string in the spoiler below. I've deliberately kept things vague here to present a challenge, however I will give a hint in that the encryption is very basic.
code (Click to show)
93e1d3d7a8c5dfcde759b5dad0e3a0b89881e2a1b58cd0dca5c98cd5d6a2bed381e2a1b1e081e59ebee081e2a1c2dbd6d5a170e0c9d359bdd5cfd259bfd281e2a1b58cc3ddb0bc8cd0d459c0d1d5e3a7b9cdd48e9ac38ccae259b6d1cdda59c7cdd48e88b88ccfdd6570dad0e259b1d3c2d7a77e8caecfa7c98cd1d3a8c0d8c68ea1b1e2c68eacc0d1c4e3a5b1e0c6d259c4d4c2e259b9d281e59e70d7cfd3b070d1d9cf9cc4d8da8eb0b8e581e2a1b58cc3ddb0bc8cd0d459c0d1d5e3a7b9cdd48ea1b1d081e2a1bfe1c8d6ad70e0c9cfad70e3c68eb0bfe1cdd259bbdad0e559b18ccdddad70d9d0e09e70cdc3ddaec48cd5d69e70dac2e2aec2d181dd9f70e0c9d359a5dacae49ec2dfc68eadb8cdcf8eb0b58cc5dd59bedbd89c

I've kept all the challenges pretty basic, so that everyone has a chance to solve them.

Happy coding and please remember to post your answers using the etiquette outlined in How post your answers (above)

Bonus Challenges:
  1. Can you answer any challenges with 1 liners?
  2. 2 challenges using Block Transposition Cyphers (post #14) courtesy of hajile.

Edited by Plan9 - 4/11/14 at 10:24am
post #2 of 36
Thank you I will definitely be trying this later!
Project Arch
(16 items)
 
BigByte
(8 items)
 
Macbook Pro
(8 items)
 
CPUMotherboardGraphicsRAM
Intel i7 5960x @ 4.8ghz Asus X99-E WS 2 x Nvidia Quadro K6000 Corsair Dominator Platinum 64gb 2666 
Hard DriveCoolingOSMonitor
2 x Samsung 850 Pro 512gb {RAID 0} Swiftech H320 w/ Noctua NF-F12 iPPC Arch Linux w/ OpenBox 2 x LG 31MU97 Cinema 4K 
KeyboardPowerCaseMouse
Vortex KBC Poker II PBT EVGA SuperNOVA 1000 G2 Corsair Obsidian 450D Zowie FK1 
Mouse PadAudioAudioOther
Steelseries QCK+ Beyerdynamic DT 770 Pro 80Ω Audioengine D1 Intel X540-T2 NIC 
CPUMotherboardRAMHard Drive
Intel Avoton C2750 Octa-Core ASRock C2750D4I Samsung 64gb ECC 1600mhz 8 x Samsung 850 Pro 1TB 
OSPowerCaseOther
FreeNAS SilverStone ST45SF-G 450w SilverStone DS380 Intel X540-T2 NIC 
CPUGraphicsGraphicsRAM
Intel i7-4960HQ Intel Iris 5200 Pro NVIDIA GT 750M 2gb 16gb (2x8gb) 1600mhz 
Hard DriveMonitorMouseMouse Pad
1tb PCIe SSD 15.4" {2880x1800} IPS SteelSeries Sensei [RAW] SteelSeries QcK Mini 
  hide details  
Reply
Project Arch
(16 items)
 
BigByte
(8 items)
 
Macbook Pro
(8 items)
 
CPUMotherboardGraphicsRAM
Intel i7 5960x @ 4.8ghz Asus X99-E WS 2 x Nvidia Quadro K6000 Corsair Dominator Platinum 64gb 2666 
Hard DriveCoolingOSMonitor
2 x Samsung 850 Pro 512gb {RAID 0} Swiftech H320 w/ Noctua NF-F12 iPPC Arch Linux w/ OpenBox 2 x LG 31MU97 Cinema 4K 
KeyboardPowerCaseMouse
Vortex KBC Poker II PBT EVGA SuperNOVA 1000 G2 Corsair Obsidian 450D Zowie FK1 
Mouse PadAudioAudioOther
Steelseries QCK+ Beyerdynamic DT 770 Pro 80Ω Audioengine D1 Intel X540-T2 NIC 
CPUMotherboardRAMHard Drive
Intel Avoton C2750 Octa-Core ASRock C2750D4I Samsung 64gb ECC 1600mhz 8 x Samsung 850 Pro 1TB 
OSPowerCaseOther
FreeNAS SilverStone ST45SF-G 450w SilverStone DS380 Intel X540-T2 NIC 
CPUGraphicsGraphicsRAM
Intel i7-4960HQ Intel Iris 5200 Pro NVIDIA GT 750M 2gb 16gb (2x8gb) 1600mhz 
Hard DriveMonitorMouseMouse Pad
1tb PCIe SSD 15.4" {2880x1800} IPS SteelSeries Sensei [RAW] SteelSeries QcK Mini 
  hide details  
Reply
post #3 of 36
Sounds great, gonna give it a go tomorrow.
Footrest
(17 items)
 
server
(17 items)
 
HTPC
(12 items)
 
CPUMotherboardGraphicsRAM
2 x Xeon L5520 Supermicro X8DTL-i HD4550 Samsung 6x4GB ECC 
Hard DriveHard DriveCoolingOS
3 x 2TB WD Green 160GB WD Blue Hyper 212+ and EVO ESXi 
OSOSOSPower
unRaid pfSense Ubuntu CX430v2 
CaseOtherOther
CM Elite 331 TP-Link TG-3269 Sil3512 Sata controller 
CPUMotherboardRAMHard Drive
i3-2100T Asus P8H61-I Geil Black Dragon 1333 2x2GB PXE Network boot 
Optical DriveCoolingOSMonitor
OEM Slim DVD Burner Scythe Big-Shuriken OpenElec Panasonic TX-P42G30E 42" HDTV 
KeyboardCase
Lenovo n5901a Silverstone SG-05 
  hide details  
Reply
Footrest
(17 items)
 
server
(17 items)
 
HTPC
(12 items)
 
CPUMotherboardGraphicsRAM
2 x Xeon L5520 Supermicro X8DTL-i HD4550 Samsung 6x4GB ECC 
Hard DriveHard DriveCoolingOS
3 x 2TB WD Green 160GB WD Blue Hyper 212+ and EVO ESXi 
OSOSOSPower
unRaid pfSense Ubuntu CX430v2 
CaseOtherOther
CM Elite 331 TP-Link TG-3269 Sil3512 Sata controller 
CPUMotherboardRAMHard Drive
i3-2100T Asus P8H61-I Geil Black Dragon 1333 2x2GB PXE Network boot 
Optical DriveCoolingOSMonitor
OEM Slim DVD Burner Scythe Big-Shuriken OpenElec Panasonic TX-P42G30E 42" HDTV 
KeyboardCase
Lenovo n5901a Silverstone SG-05 
  hide details  
Reply
post #4 of 36
easy challenge: word 2 = uncharted Source code, written in python2.7 (Click to show)
Code:
import sys
a='Gbs!pvu!jo!uif!vodibsufe!cbdlxbufst!pg!uif!vogbtijpobcmf!foe!pg!uif!xftufso!tqjsbm!bsn!pg!uif!Hbmbyz!mjft!b!tnbmm!vosfhbsefe!zfmmpx!tvo/!Pscjujoh!uijt!bu!b!ejtubodf!pg!spvhimz!ojofuz.uxp!njmmjpo!njmft!jt!bo!vuufsmz!jotjhojgjdbou!mjuumf!cmvf!hsffo!qmbofu!xiptf!bqf.eftdfoefe!mjgf!gpsnt!bsf!tp!bnb{johmz!qsjnjujwf!uibu!uifz!tujmm!uijol!ejhjubm!xbudift!bsf!b!qsfuuz!ofbu!jefb/'
for b in a:
    sys.stdout.write(chr(ord(b)-1))

sys.stdout.write('\n')

medium challenge: word 10 = alcohol. Source code, written in python2.7 (Click to show)
Code:

import sys

a='55-69-66-21-49-6a-75-64-69-2e-49-6a-6c-66-73-28-74-21-48-76-6a-65-66-21-75-70-21-75-69-66-21-48-62-6d-62-79-7a-21-62-6d-74-70-21-6e-66-6f-75-6a-70-6f-74-21-62-6d-64-70-69-70-6d-2f-21-4a-75-21-74-62-7a-74-21-75-69-62-75-21-75-69-66-21-63-66-74-75-21-65-73-6a-6f-6c-21-6a-6f-21-66-79-6a-74-75-66-6f-64-66-21-6a-74-21-75-69-66-21-51-62-6f-21-48-62-6d-62-64-75-6a-64-21-48-62-73-68-6d-66-21-43-6d-62-74-75-66-73-2d-21-75-69-66-21-66-67-67-66-64-75-21-70-67-21-78-69-6a-64-69-21-6a-74-21-6d-6a-6c-66-21-69-62-77-6a-6f-68-21-7a-70-76-73-21-63-73-62-6a-6f-74-21-74-6e-62-74-69-66-65-21-70-76-75-21-78-6a-75-69-21-62-21-74-6d-6a-64-66-21-70-67-21-6d-66-6e-70-6f-21-78-73-62-71-71-66-65-21-73-70-76-6f-65-21-62-21-6d-62-73-68-66-21-68-70-6d-65-21-63-73-6a-64-6c-2f'.split('-')
for b in a:
    sys.stdout.write(chr(ord(b.decode('hex')) - 1))

sys.stdout.write('\n')

hard challenge: word 15 = petunias Source code, written in python2.7 (Click to show)
Code:
import sys
import re

a =re.findall('..?', '93e1d3d7a8c5dfcde759b5dad0e3a0b89881e2a1b58cd0dca5c98cd5d6a2bed381e2a1b1e081e59ebee081e2a1c2dbd6d5a170e0c9d359bdd5cfd259bfd281e2a1b58cc3ddb0bc8cd0d459c0d1d5e3a7b9cdd48e9ac38ccae259b6d1cdda59c7cdd48e88b88ccfdd6570dad0e259b1d3c2d7a77e8caecfa7c98cd1d3a8c0d8c68ea1b1e2c68eacc0d1c4e3a5b1e0c6d259c4d4c2e259b9d281e59e70d7cfd3b070d1d9cf9cc4d8da8eb0b8e581e2a1b58cc3ddb0bc8cd0d459c0d1d5e3a7b9cdd48ea1b1d081e2a1bfe1c8d6ad70e0c9cfad70e3c68eb0bfe1cdd259bbdad0e559b18ccdddad70d9d0e09e70cdc3ddaec48cd5d69e70dac2e2aec2d181dd9f70e0c9d359a5dacae49ec2dfc68eadb8cdcf8eb0b58cc5dd59bedbd89c')
b = 0

for c in a:
    sys.stdout.write(chr(ord(c.decode('hex')) - ord('Plan9'[b])))
    b = b + 1 if b < 4 else 0

sys.stdout.write('\n')


(edit) adding java version

easy challenge: word 6 = backwaters
medium challenge: word 7 = Galaxy.
hard challenge: word 10 = mind Source code, written in java1.7 (Click to show)
Code:
public class Cha10 {

    public static void main(String[] args) {
        Easy();
        Medium();
        Hard();
    }
    
    public static void Easy(){
        String a = "Gbs!pvu!jo!uif!vodibsufe!cbdlxbufst!pg!uif!vogbtijpobcmf!foe!pg!uif!xftufso!tqjsbm!bsn!pg!uif!Hbmbyz!mjft!b!tnbmm!vosfhbsefe!zfmmpx!tvo/!Pscjujoh!uijt!bu!b!ejtubodf!pg!spvhimz!ojofuz.uxp!njmmjpo!njmft!jt!bo!vuufsmz!jotjhojgjdbou!mjuumf!cmvf!hsffo!qmbofu!xiptf!bqf.eftdfoefe!mjgf!gpsnt!bsf!tp!bnb{johmz!qsjnjujwf!uibu!uifz!tujmm!uijol!ejhjubm!xbudift!bsf!b!qsfuuz!ofbu!jefb/";
        for (int b = 0;b < a.length();b++){
            System.out.print( (char) ((int) a.charAt(b) - 1));
        }
        System.out.println();
    }

    public static void Medium(){
       String[] a = "55-69-66-21-49-6a-75-64-69-2e-49-6a-6c-66-73-28-74-21-48-76-6a-65-66-21-75-70-21-75-69-66-21-48-62-6d-62-79-7a-21-62-6d-74-70-21-6e-66-6f-75-6a-70-6f-74-21-62-6d-64-70-69-70-6d-2f-21-4a-75-21-74-62-7a-74-21-75-69-62-75-21-75-69-66-21-63-66-74-75-21-65-73-6a-6f-6c-21-6a-6f-21-66-79-6a-74-75-66-6f-64-66-21-6a-74-21-75-69-66-21-51-62-6f-21-48-62-6d-62-64-75-6a-64-21-48-62-73-68-6d-66-21-43-6d-62-74-75-66-73-2d-21-75-69-66-21-66-67-67-66-64-75-21-70-67-21-78-69-6a-64-69-21-6a-74-21-6d-6a-6c-66-21-69-62-77-6a-6f-68-21-7a-70-76-73-21-63-73-62-6a-6f-74-21-74-6e-62-74-69-66-65-21-70-76-75-21-78-6a-75-69-21-62-21-74-6d-6a-64-66-21-70-67-21-6d-66-6e-70-6f-21-78-73-62-71-71-66-65-21-73-70-76-6f-65-21-62-21-6d-62-73-68-66-21-68-70-6d-65-21-63-73-6a-64-6c-2f".split("\\-");
       for (String b:a){
           System.out.print((char) (Integer.parseInt(b,16) -1));
       }
        System.out.println();
    }

    public static void Hard(){
        String[] a = "93e1d3d7a8c5dfcde759b5dad0e3a0b89881e2a1b58cd0dca5c98cd5d6a2bed381e2a1b1e081e59ebee081e2a1c2dbd6d5a170e0c9d359bdd5cfd259bfd281e2a1b58cc3ddb0bc8cd0d459c0d1d5e3a7b9cdd48e9ac38ccae259b6d1cdda59c7cdd48e88b88ccfdd6570dad0e259b1d3c2d7a77e8caecfa7c98cd1d3a8c0d8c68ea1b1e2c68eacc0d1c4e3a5b1e0c6d259c4d4c2e259b9d281e59e70d7cfd3b070d1d9cf9cc4d8da8eb0b8e581e2a1b58cc3ddb0bc8cd0d459c0d1d5e3a7b9cdd48ea1b1d081e2a1bfe1c8d6ad70e0c9cfad70e3c68eb0bfe1cdd259bbdad0e559b18ccdddad70d9d0e09e70cdc3ddaec48cd5d69e70dac2e2aec2d181dd9f70e0c9d359a5dacae49ec2dfc68eadb8cdcf8eb0b58cc5dd59bedbd89c".split("(?<=\\G.{2})");
        int b = 0;
        for (String c : a){
            System.out.print((char) ((Integer.parseInt(c,16) - (int) "Plan9".charAt(b))));
            b = (b < 4) ? b + 1 : 0;
        }
        System.out.println();
    }
}

Edited by tom.slick - 4/10/14 at 11:15am
Core I7
(13 items)
 
  
CPUMotherboardGraphicsRAM
I7 920 rev. D0 @ 4.26Ghz EVGA X58 SLI EVGA GTX 285 OCZ XMP 3x2Gb (pc3 12800) 
Hard DriveOptical DriveOSMonitor
Western Digital Caviar Black 640Gb x 2 LG GH22LS30 openSuse 12.1 x64 HP F2105 
PowerCase
CORSAIR 850TX Cooler Master ATCS 840 
  hide details  
Reply
Core I7
(13 items)
 
  
CPUMotherboardGraphicsRAM
I7 920 rev. D0 @ 4.26Ghz EVGA X58 SLI EVGA GTX 285 OCZ XMP 3x2Gb (pc3 12800) 
Hard DriveOptical DriveOSMonitor
Western Digital Caviar Black 640Gb x 2 LG GH22LS30 openSuse 12.1 x64 HP F2105 
PowerCase
CORSAIR 850TX Cooler Master ATCS 840 
  hide details  
Reply
post #5 of 36
Hard Challenge: Word 13 = bowl

Source code, written in Python (Click to show)
Code:
#!/usr/bin/env python

from __future__ import print_function
import re

string = '93e1d3d7a8c5dfcde759b5dad0e3a0b89881e2a1b58cd0dca5c98cd5d6a2bed381e2a1b1e081e59ebee081e2a1c2dbd6d5a170e0c9d359bdd5cfd259bfd281e2a1b58cc3ddb0bc8cd0d459c0d1d5e3a7b9cdd48e9ac38ccae259b6d1cdda59c7cdd48e88b88ccfdd6570dad0e259b1d3c2d7a77e8caecfa7c98cd1d3a8c0d8c68ea1b1e2c68eacc0d1c4e3a5b1e0c6d259c4d4c2e259b9d281e59e70d7cfd3b070d1d9cf9cc4d8da8eb0b8e581e2a1b58cc3ddb0bc8cd0d459c0d1d5e3a7b9cdd48ea1b1d081e2a1bfe1c8d6ad70e0c9cfad70e3c68eb0bfe1cdd259bbdad0e559b18ccdddad70d9d0e09e70cdc3ddaec48cd5d69e70dac2e2aec2d181dd9f70e0c9d359a5dacae49ec2dfc68eadb8cdcf8eb0b58cc5dd59bedbd89c'
x = re.findall('..', string)
i = 0

for z in x:
    print(chr(ord(z.decode('hex')) - ord('Plan9'[i])), end='')
    i = i + 1 if i < 4 else 0

print('')

EDIT: Your user title @Plan9 lachen.gif
.
Edited by DizZz - 4/9/14 at 5:18pm
Project Arch
(16 items)
 
BigByte
(8 items)
 
Macbook Pro
(8 items)
 
CPUMotherboardGraphicsRAM
Intel i7 5960x @ 4.8ghz Asus X99-E WS 2 x Nvidia Quadro K6000 Corsair Dominator Platinum 64gb 2666 
Hard DriveCoolingOSMonitor
2 x Samsung 850 Pro 512gb {RAID 0} Swiftech H320 w/ Noctua NF-F12 iPPC Arch Linux w/ OpenBox 2 x LG 31MU97 Cinema 4K 
KeyboardPowerCaseMouse
Vortex KBC Poker II PBT EVGA SuperNOVA 1000 G2 Corsair Obsidian 450D Zowie FK1 
Mouse PadAudioAudioOther
Steelseries QCK+ Beyerdynamic DT 770 Pro 80Ω Audioengine D1 Intel X540-T2 NIC 
CPUMotherboardRAMHard Drive
Intel Avoton C2750 Octa-Core ASRock C2750D4I Samsung 64gb ECC 1600mhz 8 x Samsung 850 Pro 1TB 
OSPowerCaseOther
FreeNAS SilverStone ST45SF-G 450w SilverStone DS380 Intel X540-T2 NIC 
CPUGraphicsGraphicsRAM
Intel i7-4960HQ Intel Iris 5200 Pro NVIDIA GT 750M 2gb 16gb (2x8gb) 1600mhz 
Hard DriveMonitorMouseMouse Pad
1tb PCIe SSD 15.4" {2880x1800} IPS SteelSeries Sensei [RAW] SteelSeries QcK Mini 
  hide details  
Reply
Project Arch
(16 items)
 
BigByte
(8 items)
 
Macbook Pro
(8 items)
 
CPUMotherboardGraphicsRAM
Intel i7 5960x @ 4.8ghz Asus X99-E WS 2 x Nvidia Quadro K6000 Corsair Dominator Platinum 64gb 2666 
Hard DriveCoolingOSMonitor
2 x Samsung 850 Pro 512gb {RAID 0} Swiftech H320 w/ Noctua NF-F12 iPPC Arch Linux w/ OpenBox 2 x LG 31MU97 Cinema 4K 
KeyboardPowerCaseMouse
Vortex KBC Poker II PBT EVGA SuperNOVA 1000 G2 Corsair Obsidian 450D Zowie FK1 
Mouse PadAudioAudioOther
Steelseries QCK+ Beyerdynamic DT 770 Pro 80Ω Audioengine D1 Intel X540-T2 NIC 
CPUMotherboardRAMHard Drive
Intel Avoton C2750 Octa-Core ASRock C2750D4I Samsung 64gb ECC 1600mhz 8 x Samsung 850 Pro 1TB 
OSPowerCaseOther
FreeNAS SilverStone ST45SF-G 450w SilverStone DS380 Intel X540-T2 NIC 
CPUGraphicsGraphicsRAM
Intel i7-4960HQ Intel Iris 5200 Pro NVIDIA GT 750M 2gb 16gb (2x8gb) 1600mhz 
Hard DriveMonitorMouseMouse Pad
1tb PCIe SSD 15.4" {2880x1800} IPS SteelSeries Sensei [RAW] SteelSeries QcK Mini 
  hide details  
Reply
post #6 of 36
Easy Challenge: Word #2 = out
Source Code, written in JAVA (Click to show)
Code:
public class Main {

        public static void main(String[] args) {
                String encrypt = "Gbs!pvu!jo!uif!vodibsufe!cbdlxbufst!pg!uif!vogbtijpobcmf!foe!pg!uif!xftufso!tqjsbm!bsn!pg!uif!Hbmbyz!mjft!b!tnbmm!vosfhbsefe!zfmmpx!tvo/!Pscjujoh!uijt!bu!b!ejtubodf!pg!spvhimz!ojofuz.uxp!njmmjpo!njmft!jt!bo!vuufsmz!jotjhojgjdbou!mjuumf!cmvf!hsffo!qmbofu!xiptf!bqf.eftdfoefe!mjgf!gpsnt!bsf!tp!bnb{johmz!qsjnjujwf!uibu!uifz!tujmm!uijol!ejhjubm!xbudift!bsf!b!qsfuuz!ofbu!jefb/";
                int length = encrypt.length();
                int j = 0;
                String answer = "";
                while (j < length) {
                        //Convert String to char at position j
                        char a = encrypt.charAt(j);
                        //Decrypt char
                        int y = a - 1;
                        //Convert back to char
                        char converted = (char) y;
                        //Convert back to String
                        answer = answer + converted;
                        j++;
                }
                System.out.println(answer);

        }

}

Medium Challenge: Word #3: Guide
Source Code, Written in JAVA (Click to show)
Code:
import java.util.StringTokenizer;

public class Main {

        public static void main(String[] args) {
                String encrypt = "55-69-66-21-49-6a-75-64-69-2e-49-6a-6c-66-73-28-74-21-48-76-6a-65-66-21-75-70-21-75-69-66-21-48-62-6d-62-79-7a-21-62-6d-74-70-21-6e-66-6f-75-6a-70-6f-74-21-62-6d-64-70-69-70-6d-2f-21-4a-75-21-74-62-7a-74-21-75-69-62-75-21-75-69-66-21-63-66-74-75-21-65-73-6a-6f-6c-21-6a-6f-21-66-79-6a-74-75-66-6f-64-66-21-6a-74-21-75-69-66-21-51-62-6f-21-48-62-6d-62-64-75-6a-64-21-48-62-73-68-6d-66-21-43-6d-62-74-75-66-73-2d-21-75-69-66-21-66-67-67-66-64-75-21-70-67-21-78-69-6a-64-69-21-6a-74-21-6d-6a-6c-66-21-69-62-77-6a-6f-68-21-7a-70-76-73-21-63-73-62-6a-6f-74-21-74-6e-62-74-69-66-65-21-70-76-75-21-78-6a-75-69-21-62-21-74-6d-6a-64-66-21-70-67-21-6d-66-6e-70-6f-21-78-73-62-71-71-66-65-21-73-70-76-6f-65-21-62-21-6d-62-73-68-66-21-68-70-6d-65-21-63-73-6a-64-6c-2f";
                StringTokenizer st = new StringTokenizer(encrypt, "-");
                String answer = "";
                while (st.hasMoreTokens()) {
                        // Convert hex back to char
                        char a = (char)Integer.parseInt(st.nextToken(), 16);
                        // Decrypt char
                        int y = a - 1;
                        // Convert back to char
                        char converted = (char) y;
                        // Convert back to String
                        answer = answer + converted;
                }
                System.out.println(answer);

        }

}

Edited by thestraw0039 - 4/9/14 at 7:25pm
post #7 of 36
Easy: 61 = idea Source code, written in JS (Click to show)
Code:
var encrypted = "Gbs!pvu!jo!uif!vodibsufe!cbdlxbufst!pg!uif!vogbtijpobcmf!foe!pg!uif!xftufso!tqjsbm!bsn!pg!uif!Hbmbyz!mjft!b!tnbmm!vosfhbsefe!zfmmpx!tvo/!Pscjujoh!uijt!bu!b!ejtubodf!pg!spvhimz!ojofuz.uxp!njmmjpo!njmft!jt!bo!vuufsmz!jotjhojgjdbou!mjuumf!cmvf!hsffo!qmbofu!xiptf!bqf.eftdfoefe!mjgf!gpsnt!bsf!tp!bnb{johmz!qsjnjujwf!uibu!uifz!tujmm!uijol!ejhjubm!xbudift!bsf!b!qsfuuz!ofbu!jefb/";
var decrypted = "";
for(var i = 0; i < encrypted.length; i++){
        decrypted += String.fromCharCode(encrypted[i].charCodeAt() - 1);
}

Medium: 45 = brick Source code, written in JS (Click to show)
Code:
var encrypted = "55-69-66-21-49-6a-75-64-69-2e-49-6a-6c-66-73-28-74-21-48-76-6a-65-66-21-75-70-21-75-69-66-21-48-62-6d-62-79-7a-21-62-6d-74-70-21-6e-66-6f-75-6a-70-6f-74-21-62-6d-64-70-69-70-6d-2f-21-4a-75-21-74-62-7a-74-21-75-69-62-75-21-75-69-66-21-63-66-74-75-21-65-73-6a-6f-6c-21-6a-6f-21-66-79-6a-74-75-66-6f-64-66-21-6a-74-21-75-69-66-21-51-62-6f-21-48-62-6d-62-64-75-6a-64-21-48-62-73-68-6d-66-21-43-6d-62-74-75-66-73-2d-21-75-69-66-21-66-67-67-66-64-75-21-70-67-21-78-69-6a-64-69-21-6a-74-21-6d-6a-6c-66-21-69-62-77-6a-6f-68-21-7a-70-76-73-21-63-73-62-6a-6f-74-21-74-6e-62-74-69-66-65-21-70-76-75-21-78-6a-75-69-21-62-21-74-6d-6a-64-66-21-70-67-21-6d-66-6e-70-6f-21-78-73-62-71-71-66-65-21-73-70-76-6f-65-21-62-21-6d-62-73-68-66-21-68-70-6d-65-21-63-73-6a-64-6c-2f";
var decrypted = "";
var chars = String.split(encrypted, "-");
for(var i = 0; i < chars.length; i++){
        decrypted += String.fromCharCode(parseInt(chars[i], 16) - 1);
}

Edited by Tnt6200 - 4/10/14 at 6:29pm
The Clunker
(11 items)
 
Lenovo Y40
(6 items)
 
 
CPUMotherboardGraphicsRAM
Core 2 Quad Q8400 Asus P5P43TD Powercolor 7950 4GB Patriot Viper 
Hard DriveHard DriveCoolingOS
80GB WD Caviar Blue 500GB WD Caviar Black Coolermaster Hyper TX Windows 7 Home Premium 64-bit 
MonitorPowerCase
20" Samsung Corsair CX600M Antec 300 
CPUGraphicsRAMHard Drive
i7-4510U R9 M275 2GB 8GB @ 1600MHz 500+8GB 5400rpm SSHD 
OSMonitor
Windows 8.1 14" 1080p 
  hide details  
Reply
The Clunker
(11 items)
 
Lenovo Y40
(6 items)
 
 
CPUMotherboardGraphicsRAM
Core 2 Quad Q8400 Asus P5P43TD Powercolor 7950 4GB Patriot Viper 
Hard DriveHard DriveCoolingOS
80GB WD Caviar Blue 500GB WD Caviar Black Coolermaster Hyper TX Windows 7 Home Premium 64-bit 
MonitorPowerCase
20" Samsung Corsair CX600M Antec 300 
CPUGraphicsRAMHard Drive
i7-4510U R9 M275 2GB 8GB @ 1600MHz 500+8GB 5400rpm SSHD 
OSMonitor
Windows 8.1 14" 1080p 
  hide details  
Reply
post #8 of 36
Ooo just found this thread!

Easy: 18 = Galaxy Written in C# NET (Click to show)
Code:
            //Code context is for an event handler.
            String temp = textBox1.Text;
            String output = "";

            Int32 charNumb = 0;

            temp.Replace("!", " ");

            foreach(char chartemp in temp)
            {
                charNumb = System.Convert.ToInt32(chartemp);

                charNumb--;

                output += System.Convert.ToChar(charNumb);
            }

            textBox2.Text = output;

Medium: 9 = Alcohol Written in C# NET (Click to show)
Code:
            //Code context is for an event handler.
            String temp = textBox3.Text;
            String output = "";

            int charNumb = 0;

            foreach(String hex in temp.Split('-'))
            {
                if (!(String.IsNullOrEmpty(hex)))
                {
                    charNumb = System.Convert.ToInt32(hex, 16);

                    charNumb--;

                    output += System.Convert.ToChar(charNumb);
                }
            }

            textBox2.Text = output;

Hard: 10 = Mind Written in C# NET (Click to show)
Code:
            //Code context is for an event handler.
            textBox2.Text = "";

            String encrypted = textBox4.Text;

            List<String> newList = new List<String>();

            Char[] cipher = { 'P', 'l', 'a', 'n', '9' };

            String output = "";
            String temp = "";

            int listCounter = 0;

            //Traveller
            Int32 ciphNumb = 0;

            //Encoded Letter
            Int32 charNumb = 0;

            //Result
            Int32 result = 0;

            foreach(Char charTemp in encrypted)
            {        
                if (listCounter == 2)
                {
                    listCounter = 0;
                    newList.Add(temp);
                    temp = "";
                }

                temp += charTemp;
                listCounter++;
            }
            
            foreach (String strTemp in newList)
            {
                if (ciphNumb > 4)
                {
                    ciphNumb = 0;
                }

                charNumb = System.Convert.ToInt32(strTemp, 16);
                result = charNumb - System.Convert.ToInt32(cipher[ciphNumb]);

                output += System.Convert.ToChar(result);

                ciphNumb++;
            }

            textBox2.Text = output;

I did notice that there are some characters missing in my Hard output. Was very strange.
Edited by RagingCain - 4/10/14 at 10:56am
Snowdevil
(16 items)
 
ASUS G750JM
(9 items)
 
 
CPUMotherboardGraphicsGraphics
[i7 4790K @ 4.4 GHz (1.186v)] [Asus Sabertooth Z97 Mark S] [nVidia Geforce GTX 1080] [nVidia Geforce GTX 1080] 
RAMHard DriveCoolingOS
[G.Skill 32GB DDR3 2133 MHz] [Crucial MX100 256GB] [Phanteks PH-TC12DX] [Win 10.1 Pro] 
MonitorMonitorKeyboardPower
[LG 29UM65 (2560x1080)] [QNIX Evo II LED (2560x1440)] [WASD v2 Tenkeyless] [NZXT Hale90 v2 ] 
CaseMouseMouse PadAudio
[ThermalTake GT10 Snow Edition] [Razer Mamba - Chroma] [Razer Kabuto] [Razer Man O' War] 
CPUMotherboardGraphicsRAM
i7 4770HQ Intel HM87 Express Chipset Geforce GTX 860M 8GB DDR3L 1600 MHz 
Hard DriveOptical DriveCoolingOS
Samsung SSD EVO DVD-RW Stock Windows 8.1 
Monitor
1920x1080 TN 
  hide details  
Reply
Snowdevil
(16 items)
 
ASUS G750JM
(9 items)
 
 
CPUMotherboardGraphicsGraphics
[i7 4790K @ 4.4 GHz (1.186v)] [Asus Sabertooth Z97 Mark S] [nVidia Geforce GTX 1080] [nVidia Geforce GTX 1080] 
RAMHard DriveCoolingOS
[G.Skill 32GB DDR3 2133 MHz] [Crucial MX100 256GB] [Phanteks PH-TC12DX] [Win 10.1 Pro] 
MonitorMonitorKeyboardPower
[LG 29UM65 (2560x1080)] [QNIX Evo II LED (2560x1440)] [WASD v2 Tenkeyless] [NZXT Hale90 v2 ] 
CaseMouseMouse PadAudio
[ThermalTake GT10 Snow Edition] [Razer Mamba - Chroma] [Razer Kabuto] [Razer Man O' War] 
CPUMotherboardGraphicsRAM
i7 4770HQ Intel HM87 Express Chipset Geforce GTX 860M 8GB DDR3L 1600 MHz 
Hard DriveOptical DriveCoolingOS
Samsung SSD EVO DVD-RW Stock Windows 8.1 
Monitor
1920x1080 TN 
  hide details  
Reply
post #9 of 36
Easy Challenge
word 19 = lies Source Code, written in Haskell (Click to show)
Code:
import System.IO

main = do
        putStrLn "Input the Encrypted String: " 
        encrypted <- getLine 
        let decrypted = [ pred(l) | l <- encrypted]
        writeFile "decrypted.txt" decrypted

Trying to teach myself Haskell, so if anyone sees something I did improperly please tell me. I'm going to try to work on the harder challenges as I get time.
Edited by FateousMaximous - 4/10/14 at 11:42am
post #10 of 36
Easy Challenge: 9 = unfashionable
Source code, written in PHP 5.5.3 (Click to show)
Code:
$encoded = 'Gbs!pvu!jo!uif!vodibsufe!cbdlxbufst!pg!uif!vogbtijpobcmf!foe!pg!uif!xftufso!tqjsbm!bsn!pg!uif!Hbmbyz!mjft!b!tnbmm!vosfhbsefe!zfmmpx!tvo/!Pscjujoh!uijt!bu!b!ejtubodf!pg!spvhimz!ojofuz.uxp!njmmjpo!njmft!jt!bo!vuufsmz!jotjhojgjdbou!mjuumf!cmvf!hsffo!qmbofu!xiptf!bqf.eftdfoefe!mjgf!gpsnt!bsf!tp!bnb{johmz!qsjnjujwf!uibu!uifz!tujmm!uijol!ejhjubm!xbudift!bsf!b!qsfuuz!ofbu!jefb/';
$decoded = '';

$chars = str_split($encoded);
foreach ($chars as $char)
    $decoded .= chr(ord($char) - 1);

echo $decoded;

Medium Challenge: 22 = Gargle Source code, written in PHP 5.5.3 (Click to show)
Code:
$encoded = "55-69-66-21-49-6a-75-64-69-2e-49-6a-6c-66-73-28-74-21-48-76-6a-65-66-21-75-70-21-75-69-66-21-48-62-6d-62-79-7a-21-62-6d-74-70-21-6e-66-6f-75-6a-70-6f-74-21-62-6d-64-70-69-70-6d-2f-21-4a-75-21-74-62-7a-74-21-75-69-62-75-21-75-69-66-21-63-66-74-75-21-65-73-6a-6f-6c-21-6a-6f-21-66-79-6a-74-75-66-6f-64-66-21-6a-74-21-75-69-66-21-51-62-6f-21-48-62-6d-62-64-75-6a-64-21-48-62-73-68-6d-66-21-43-6d-62-74-75-66-73-2d-21-75-69-66-21-66-67-67-66-64-75-21-70-67-21-78-69-6a-64-69-21-6a-74-21-6d-6a-6c-66-21-69-62-77-6a-6f-68-21-7a-70-76-73-21-63-73-62-6a-6f-74-21-74-6e-62-74-69-66-65-21-70-76-75-21-78-6a-75-69-21-62-21-74-6d-6a-64-66-21-70-67-21-6d-66-6e-70-6f-21-78-73-62-71-71-66-65-21-73-70-76-6f-65-21-62-21-6d-62-73-68-66-21-68-70-6d-65-21-63-73-6a-64-6c-2f";
$decoded = '';

$chars = explode ('-', $encoded);
foreach ($chars as $char)
    $decoded .= chr(hexdec($char) - 1);
        
echo $decoded;
New Posts  All Forums:Forum Nav:
  Return Home
  Back to Forum: Coding and Programming
Overclock.net › Forums › Software, Programming and Coding › Coding and Programming › Programming Challenge #10: Fun with cryptography