Thread: C++/C Beginners Codebreak challenge

  1. #16
    Registered User kryptkat's Avatar
    Join Date
    Dec 2002
    Posts
    638
    so the key is plain text ? not obscure sequence of letters ?
    function took plaintextforencryption.txt removed all tokens and white spaces. ended up with 1184.
    where chiperdoc.txt is 1210 to compare. why the diff in txt size ? meow messed something up ?
    function printed the table with out index used diff method.
    function used known plain txt size to extract key. it should have produced key. need to take another look and try to figure out what and why it did not work. using this to learn cpp better. prog is in cpp.
    was testing the function.

  2. #17
    Registered User rogster001's Avatar
    Join Date
    Aug 2006
    Location
    Liverpool UK
    Posts
    1,472
    why the diff in txt size ? meow messed something up ?
    haha maybe im looking at an older version than the one posted, i will check it, i only used word to count the characters, nothing else.

    but hey i think you need to think about something there, the cipherdoc has nothing to do with the plaintext, they are seperate tasks and/so the character count is totally different.
    god i am confusing myself now! All you need to do is work out the key to crack the cipherdoc, then this key will be used to encrypt the plaintext as a secondary task, which just becomes an exercise in string handling and arrays for example

    bear in mind that just because you think the key may be N length, does not mean that it will divide into the coded text exactly,

    Yes the key is just a normal english word, i was not going to make it so tough as to have a random key. or even one in a foreign language, though i completed a test like this from a cold start and the plaintext turned out to be a piece of french literature once decoded, which you could say made things 'slightly trickier' when analysing.

    i have reattached an updated cipherdoc, it has a slight amendment as i saw a typo in the source document i used after checking through today, i have tested, including online crackers and the typo did not affect ability to crack with same techniques and key, but here is the amended version just to set it straight
    Last edited by rogster001; 01-26-2010 at 11:33 AM.

  3. #18
    Registered User kryptkat's Avatar
    Join Date
    Dec 2002
    Posts
    638
    tested another function. your key is 5 or 7 char. one word that came up is 'wires' is that in the ciphertext.doc or just one of those word that have no relation to the message text but just happen to show up ? i know it is not 'wires' because i tried it as the key. and many other words.

  4. #19
    Registered User rogster001's Avatar
    Join Date
    Aug 2006
    Location
    Liverpool UK
    Posts
    1,472
    good work.. it sounds like you are getting somewhere, you are right wires is not the key, and i checked the source document, wires is not in there either, but i thought it might have been just as a thought does your function as it stands let you correctly encrypt and decrypt test documents with a key of your own choosing? just in case...

  5. #20
    Registered User kryptkat's Avatar
    Join Date
    Dec 2002
    Posts
    638
    ran in to a few errors. "can not convert a char constant" and " can not convert char * to char[] " and "can not convert char * to char * " and " link errors" .

    more to be done. i do not think it is working correctly yet.

  6. #21
    Registered User
    Join Date
    Jan 2010
    Posts
    412
    There's an error in the cipherdoc.txt from post 17 At character position 375 there should be a 'd' inserted.
    I'm attaching a fixed version.

    I'm currently working on getting my code to automatically find the key. It still needs a bit of manual poking to get the correct key. I'm also a bit over the <200 line requirement
    Will post an update when/if I get it working correctly.

  7. #22
    Registered User rogster001's Avatar
    Join Date
    Aug 2006
    Location
    Liverpool UK
    Posts
    1,472
    i did fix 'an' error in the text, i needed to replace two characters i think, did repost the correct version, why did you amend it again? it translates perfectly using my key? and also not just using my software but other third party cracker software online as a test using the key.

    your posted 'corrected' version does not translate correctly using the key, you have letters missing, and not the ones i originally had to update so what are you on about?



    200 lines was a bit tight i admit, just a guide i say.....;->

  8. #23
    Registered User
    Join Date
    Jan 2010
    Posts
    412
    Hmm that's weird. Then either the forums or my browser must be doing something to corrupt the ciphertext. Can you please upload it again in a zip archive or similar that uses crc-verification?

  9. #24
    Registered User kryptkat's Avatar
    Join Date
    Dec 2002
    Posts
    638
    it would have to be a .doc or .txt. this board does not let you put up .zip files.

    what 200 line requirement ? meow ?

    mind never i found it.
    The winning program will be a single source file, maximum of 200 lines, including empty lines.
    Last edited by kryptkat; 02-10-2010 at 05:36 PM.

  10. #25
    Registered User rogster001's Avatar
    Join Date
    Aug 2006
    Location
    Liverpool UK
    Posts
    1,472
    apologies! there was a stray uppercase letter in my source doc, you were right _mike...i have now compared everything and we are singing from the same hymn sheet so, cipherdoc_fixed is the one to use, ay caramba....

    And so congrats...you must have broken it??...you wanna PM me the keyword?
    Last edited by rogster001; 02-11-2010 at 03:40 AM.

  11. #26
    Registered User
    Join Date
    Jan 2010
    Posts
    412
    I've sent you a PM.
    I will post a public solution on decrypting and encrypting the files here once I have some free time over to convert the C# winforms project I made to a console C++ app.

  12. #27
    Registered User kryptkat's Avatar
    Join Date
    Dec 2002
    Posts
    638
    46 C:\Dev-Cpp\project333 misc\cvckeyfreq.cpp ISO C++ forbids comparison between pointer and integer

    Code:
        b =  strlen(a);
    output is 1867
    on the fixed .doc ?
    on the fixed .doc ? why is the char count different not 1210 ?

    i am still running into errors.

  13. #28
    Registered User
    Join Date
    Jan 2010
    Posts
    412
    Quote Originally Posted by kryptkat View Post
    on the fixed .doc ? why is the char count different not 1210 ?

    i am still running into errors.
    I think you might be misunderstanding what the task is about.
    The supplied cipherdoc and plaintext documents have nothing to do with each other really.
    You are to crack the cipherdoc to find out the key used, and then use that same key to encrypt the plaintext document.

  14. #29
    Registered User rogster001's Avatar
    Join Date
    Aug 2006
    Location
    Liverpool UK
    Posts
    1,472
    Kat mate i did try and point that out to you once before man

  15. #30
    Registered User kryptkat's Avatar
    Join Date
    Dec 2002
    Posts
    638
    cipherdoc_fixed.txt
    "jnlpgfajtaoifmvfefbjdefbwsyupcslwadbbtiififdgotwl vievqhgejmpdewvijnwbqdoexkmeeivieeivjcstvbbdmupnuw oqlwbkogabkohwkqocwqxfdlpgjdwiqgatmvuejucdhavguhsb epudlrfrxwtnngblvslwpfmsbjfmsbkdadbctktcvbnqskodgn eblucnbtawpuhaaybslpgbnstauiuinfnyqpfmalpjnwbgfnlp efnlctzwzqeiwsakotwvffdsachefmtblkgocoducoihcnbtgz codziftoemqgtzmeiajieuejquuiuaqgtglczsuwoqulmttufn qstmvcuedgnjtltgseeikosgndbbtiifshzquolgrfcgurvtav inaupkoekktjtakcmtgtgsafkgtrwywjrwldzhaaobczqpfswf efevmfuhwtgwedwhueuppplgoabvsqnbbdmcutzmvjmwipetzw whhtidcaymuxojsybsxwtnadtaseuwioikmfcyjmuqeubgesuq gotankdifavjtmbkpnkbjfbjqvjszoqwejvofnlawtpwvffdxc peifohprzqueixngsefkgfnyqpfaflcgtwzcoaywpjsavixaab koghmtjovmpeevbjfpjwlfclbjfrwzgnaavqolqntbgempusgn dbbtiifshzquolgrfdanhfrwvefefokoesvfuhgciihwlgwolm fnokbqghaavjmwipelsziffgzvvnwbqxajludofavsuubkpngn jjssvcmylqeblwvijnwihuejpgoenmttuukgfdwlkocgurmelq phafgqghaaufvwzcmdwakhnknqsilogprymudhwcvaakegeikp rsifbgssmkefsknwmlqkqoslzwdtwlcnaupkoetiufdgvvievm ujgfahprtidcaymueixngsefkgfnyqpfifmkhhlmgofanvzfgc tuhaaobczqpfpjqpuevucuhwucuiuinbslzqooeqeblsvfbclc csistvbbdmuxilpwopjmefdwvvfdskevrskabnvectukmfcylp gcrabkthsvfbmwzkdafoqwejvofnlaviomojcatjchekeqskoi udofbkouwldzhaaupnzmpsyhzgwokbdbbtiifaxbgshaaffalp koeaojuewvufvwvvzofmviesvcmylqeblwvijnwectnwdgssmk efsknwmlqkqnpdmvfdsvfsafwpmysngxpjwisaeayjtzmocajz ctsavimygjxjomagsrgzucatjchegkevpamfuhwtwdakqcoczi ksoxucuhwucuiuacucsudsivoggrgugjgzbgfnlegotqmkhhlb qfiypvfefbjjrlgpjnwpgqlsggeafqoqojbcotjwnfifbjfekb cclaajnefbqgtzmctsgkkbtawpgojbjfavdcocwugotgnudiwv efaflviekbcuikbkdadaqdiwbamalmtdadtgetzmtpystuualq uuiuintouqguyzmcmsgivueexvfdlwtffgzouhwaejefbkgiuw thafqubtawptoxbjfpwzkpdopkmeuinmifowqofoqwejvofnli pesgkkftqbqhinmoprwuqoeqipepjmuuiymvpsuqgotankdefl gbvgzvirgciiombjjsdqhfbsjdbgweqskwlkomsvajnlmnmeub wblxqgmdkbaqiuinpfzqueaqipemslgdofbtjbmbkpnkbjbtow wmdzixfakawsevpktfsugjrjmuqeubkwegnvievqhgejmpdesv fbnstauiuinfnyqpfs"
    b = strlen(a);
    b = 1867 char long not the 1210 as first text file. you added more than just a 'd' ?
    i understand the challange. undo file 'a' get key use key to do file 'b'.
    Code:
         cout << strlen("jnlpgfajtaoifmvfefbjdefbwsyupcslwadbbtiififdgotwlvievqhgejmpdewvijnwbqdoexkmeeivieeivjcstvbbdmupnuwoqlwbkogabkohwkqocwqxfdlpgjdwiqgatmvuejucdhavguhsbepudlrfrxwtnngblvslwpfmsbjfmsbkdadbctktcvbnqskodgneblucnbtawpuhaaybslpgbnstauiuinfnyqpfmalpjnwbgfnlpefnlctzwzqeiwsakotwvffdsachefmtblkgocoducoihcnbtgzcodziftoemqgtzmeiajieuejquuiuaqgtglczsuwoqulmttufnqstmvcuedgnjtltgseeikosgndbbtiifshzquolgrfcgurvtavinaupkoekktjtakcmtgtgsafkgtrwywjrwldzhaaobczqpfswfefevmfuhwtgwedwhueuppplgoabvsqnbbdmcutzmvjmwipetzwwhhtidcaymuxojsybsxwtnadtaseuwioikmfcyjmuqeubgesuqgotankdifavjtmbkpnkbjfbjqvjszoqwejvofnlawtpwvffdxcpeifohprzqueixngsefkgfnyqpfaflcgtwzcoaywpjsavixaabkoghmtjovmpeevbjfpjwlfclbjfrwzgnaavqolqntbgempusgndbbtiifshzquolgrfdanhfrwvefefokoesvfuhgciihwlgwolmfnokbqghaavjmwipelsziffgzvvnwbqxajludofavsuubkpngnjjssvcmylqeblwvijnwihuejpgoenmttuukgfdwlkocgurmelqphafgqghaaufvwzcmdwakhnknqsilogprymudhwcvaakegeikprsifbgssmkefsknwmlqkqoslzwdtwlcnaupkoetiufdgvvievmujgfahprtidcaymueixngsefkgfnyqpfifmkhhlmgofanvzfgctuhaaobczqpfpjqpuevucuhwucuiuinbslzqooeqeblsvfbclccsistvbbdmuxilpwopjmefdwvvfdskevrskabnvectukmfcylpgcrabkthsvfbmwzkdafoqwejvofnlaviomojcatjchekeqskoiudofbkouwldzhaaupnzmpsyhzgwokbdbbtiifaxbgshaaffalpkoeaojuewvufvwvvzofmviesvcmylqeblwvijnwectnwdgssmkefsknwmlqkqnpdmvfdsvfsafwpmysngxpjwisaeayjtzmocajzctsavimygjxjomagsrgzucatjchegkevpamfuhwtwdakqcocziksoxucuhwucuiuacucsudsivoggrgugjgzbgfnlegotqmkhhlbqfiypvfefbjjrlgpjnwpgqlsggeafqoqojbcotjwnfifbjfekbcclaajnefbqgtzmctsgkkbtawpgojbjfavdcocwugotgnudiwvefaflviekbcuikbkdadaqdiwbamalmtdadtgetzmtpystuualquuiuintouqguyzmcmsgivueexvfdlwtffgzouhwaejefbkgiuwthafqubtawptoxbjfpwzkpdopkmeuinmifowqofoqwejvofnlipesgkkftqbqhinmoprwuqoeqipepjmuuiymvpsuqgotankdeflgbvgzvirgciiombjjsdqhfbsjdbgweqskwlkomsvajnlmnmeubwblxqgmdkbaqiuinpfzqueaqipemslgdofbtjbmbkpnkbjbtowwmdzixfakawsevpktfsugjrjmuqeubkwegnvievqhgejmpdesvfbnstauiuinfnyqpfs") << endl ;
    just to double check
    output is
    C:\Dev-Cpp\project333 misc>cvckeyfreq
    1867 string length
    1867 double check string length
    a z0 ==> 97
    b z1 ==> 89
    c z2 ==> 65
    d z3 ==> 62
    e z4 ==> 100
    f z5 ==> 114
    g z6 ==> 96
    h z7 ==> 45
    i z8 ==> 87
    j z9 ==> 71
    k z10 ==> 73
    l z11 ==> 65
    m z12 ==> 76
    n z13 ==> 70
    o z14 ==> 84
    p z15 ==> 69
    q z16 ==> 71
    r z17 ==> 22
    s z18 ==> 80
    t z19 ==> 80
    u z20 ==> 100
    v z21 ==> 77
    w z22 ==> 90
    x z23 ==> 19
    y z24 ==> 24
    z z25 ==> 41

    C:\Dev-Cpp\project333 misc>

    going to have to rest for a while.

    edit add
    when you add up all the numbers on the output you get 1867 char
    Last edited by kryptkat; 02-12-2010 at 10:44 AM.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Beginners C Programming Challenge
    By UCnLA in forum C Programming
    Replies: 23
    Last Post: 04-01-2008, 07:46 PM
  2. Beginners C Programming Challenge
    By UCnLA in forum C Programming
    Replies: 2
    Last Post: 03-18-2008, 12:15 PM
  3. for beginner's or anyone interested
    By Iconoklast in forum A Brief History of Cprogramming.com
    Replies: 3
    Last Post: 03-25-2004, 02:45 PM
  4. Requesting a challenge
    By RealityFusion in forum C++ Programming
    Replies: 8
    Last Post: 08-18-2003, 08:24 PM
  5. What is a good beginners' C++ book?
    By GrNxxDaY in forum C++ Programming
    Replies: 1
    Last Post: 07-29-2002, 09:50 AM