Programming Challenge #10: Fun with cryptography - Overclock.net - An Overclocking Community

Forum Jump: 

Programming Challenge #10: Fun with cryptography

Reply
 
Thread Tools
post #1 of 36 (permalink) Old 04-09-2014, 07:51 AM - Thread Starter
New to Overclock.net
 
Plan9's Avatar
 
Join Date: Nov 2011
Location: Planet Vegeta
Posts: 8,040
Rep: 574 (Unique: 277)
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.
Plan9 is offline  
Sponsored Links
Advertisement
 
post #2 of 36 (permalink) Old 04-09-2014, 08:22 AM
Retired Staff
 
DizZz's Avatar
 
Join Date: Nov 2012
Location: 127.0.0.1
Posts: 6,517
Rep: 548 (Unique: 358)
Thank you I will definitely be trying this later!


DizZz is offline  
post #3 of 36 (permalink) Old 04-09-2014, 08:48 AM
New to Overclock.net
 
Aximous's Avatar
 
Join Date: Dec 2009
Location: Hungary
Posts: 490
Rep: 23 (Unique: 21)
Sounds great, gonna give it a go tomorrow.
Aximous is offline  
Sponsored Links
Advertisement
 
post #4 of 36 (permalink) Old 04-09-2014, 01:30 PM
New to Overclock.net
 
tom.slick's Avatar
 
Join Date: May 2009
Location: Orange County
Posts: 1,012
Rep: 158 (Unique: 128)
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();
    }
}


tom.slick is offline  
post #5 of 36 (permalink) Old 04-09-2014, 05:15 PM
Retired Staff
 
DizZz's Avatar
 
Join Date: Nov 2012
Location: 127.0.0.1
Posts: 6,517
Rep: 548 (Unique: 358)
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
.


DizZz is offline  
post #6 of 36 (permalink) Old 04-09-2014, 06:24 PM
New to Overclock.net
 
thestraw0039's Avatar
 
Join Date: Jun 2012
Posts: 302
Rep: 25 (Unique: 20)
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);

        }

}
thestraw0039 is offline  
post #7 of 36 (permalink) Old 04-09-2014, 08:26 PM
New to Overclock.net
 
Tnt6200's Avatar
 
Join Date: Oct 2011
Location: Victoria, BC
Posts: 891
Rep: 77 (Unique: 58)
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);
}

You're already in pain. You're already hurt. Get a reward from it.
Tnt6200 is offline  
post #8 of 36 (permalink) Old 04-10-2014, 08:52 AM
Software Developer
 
RagingCain's Avatar
 
Join Date: Oct 2010
Location: Jacksonville, FL
Posts: 7,203
Rep: 727 (Unique: 510)
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.

My Site: HouseofCat
My Repos: GitHub Repository
RagingCain is offline  
post #9 of 36 (permalink) Old 04-10-2014, 09:50 AM
New to Overclock.net
 
FateousMaximous's Avatar
 
Join Date: Jun 2011
Location: Colorado
Posts: 213
Rep: 22 (Unique: 16)
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.
FateousMaximous is offline  
post #10 of 36 (permalink) Old 04-10-2014, 04:26 PM
New to Overclock.net
 
ccRicers's Avatar
 
Join Date: Oct 2013
Location: Chicago, IL
Posts: 2,791
Rep: 72 (Unique: 66)
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;
ccRicers is offline  
Reply

Quick Reply
Message:
Options

Register Now

In order to be able to post messages on the Overclock.net - An Overclocking Community forums, you must first register.
Please enter your desired user name, your email address and other required details in the form below.
User Name:
If you do not want to register, fill this field only and the name will be used as user name for your post.
Password
Please enter a password for your user account. Note that passwords are case-sensitive.
Password:
Confirm Password:
Email Address
Please enter a valid email address for yourself.
Email Address:

Log-in



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Show Printable Version Show Printable Version
Email this Page Email this Page


Forum Jump: 

Posting Rules  
You may post new threads
You may post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off