{"id":40743532,"url":"https://github.com/blester125/kasiski_examination","last_synced_at":"2026-01-21T15:31:06.151Z","repository":{"id":94859499,"uuid":"58400780","full_name":"blester125/Kasiski_Examination","owner":"blester125","description":"Kasiski Examination written to break a Vigenere Cipher for CS 1653 includes a C Red-Black tree impelmenatation","archived":false,"fork":false,"pushed_at":"2020-04-03T13:47:01.000Z","size":18,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-09-09T17:04:40.771Z","etag":null,"topics":["cryptography","kasiski-examination","red-black-tree"],"latest_commit_sha":null,"homepage":"","language":"C","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/blester125.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2016-05-09T19:01:19.000Z","updated_at":"2024-08-31T06:22:06.000Z","dependencies_parsed_at":"2023-03-13T16:55:14.741Z","dependency_job_id":null,"html_url":"https://github.com/blester125/Kasiski_Examination","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/blester125/Kasiski_Examination","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/blester125%2FKasiski_Examination","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/blester125%2FKasiski_Examination/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/blester125%2FKasiski_Examination/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/blester125%2FKasiski_Examination/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/blester125","download_url":"https://codeload.github.com/blester125/Kasiski_Examination/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/blester125%2FKasiski_Examination/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28635816,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-21T15:01:31.228Z","status":"ssl_error","status_checked_at":"2026-01-21T14:42:58.942Z","response_time":86,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["cryptography","kasiski-examination","red-black-tree"],"created_at":"2026-01-21T15:31:06.035Z","updated_at":"2026-01-21T15:31:06.144Z","avatar_url":"https://github.com/blester125.png","language":"C","funding_links":[],"categories":[],"sub_categories":[],"readme":"# CS 1653 Vigenere Cipher\n\n##\n\n### Kasiski Examination Program.\n\nThis program can preform Kasiski analysis and decode ciphertext if provided a \nkey.\n\nTo compile this program run \n\t`make`\nThis will create a program called \"breaker\" this can be run in 2 way. The \nfirst way preforms Kasiski analysis on file.txt and is run like so.\n\n\t./breaker kasiski \u003c file.txt\t\n\nThis strips all white space and punctuation marks from the incoming \nciphertext.\n\nThe program then runs Kasiski analysis and tries to find the greatest common \ndenominator of all the the distances between repeated words. If a usable \ngreatest common denominator is found (i.e. not 1) then it is returned. \nOtherwise it calculates which gap distances are the most likely to be the key \nlength. \n\nThis analysis doesn't ignore sub string repeats, for example the string \n\"homework at home\" will have matches of:\n\n* \"home\" at 0 and 12\n* \"ome\" at 1 and 13\n\nThis is ok because the actual gaps between the numbers are the same. \nThe gap distances are stored in a set to this same gap width happening \nagain and again will not effect anything.\n\nThe program can also be used to decode ciphertext using the Vigenere cipher \ngiven the key. It is run like so:\n\n\t./breaker decode key \u003c file.txt\n\nLike before the spaces and punctuation will be stripped before decoded and \nrestored later. This implements the shift like so:\n\n* a = 0\n* b = 1\n* ...\n* z = 25\n\nThis means that if there is an a in the key then the plaintext will match \nthe ciphertext. \n\n\n### Approach used to break the cipher.\n\nAfter I used my program to establish the fact that the key was most likely of \nlength 7 I figured out the key based on the first word of the ciphertext. The \nfirst word was \"dsyrrshvpleigbt!\" The fact that this word is the first word, ends \nwith an exclamation point and is 15 letters long it seems pretty obvious that the\nword will decode to \"congratulations!\" Once I guess that this was the first word \nI found a key of length 7 that would cause \"dsyrrshvpleigbt!\" to decode to\n\"congratulations!\" \n\n* 'd' -\u003e 'c' is a shift of 1 so the first letter of the key is 'a'.\n* 's' -\u003e 'o' is a shift of 4 so the second letter is 'd'.\n* 'y' -\u003e 'n' is a shift of 11 so the third letter is 'k'.\n* 'r' -\u003e 'g' is a shift of 11 so the fourth letter is 'k'.\n* 'r' -\u003e 'r' is a shift of 26 so the fifth letter is 'z'.\n* 's' -\u003e 'a' is a shift of 18 so the sixth letter is 'r'.\n* 'h' -\u003e 't' is a shift of 14 so the last letter is 'n'.\n* 'v' -\u003e 'u' is a shift of 1 so the first letter is confirmed 'a'.\n* 'p' -\u003e 'l' is a shift of 4 so the second letter is confirmed 'd'.\n* ...\n\nThis key works to decode congratulations from dsyrrshvpleigbt. So I wrote up the\ndecode program to see if this decoded the entire message. I implemented this so \nthat the key is repeated once it ends however the letter of the key are not used \nfor spaces or punctuation which seems the standard practice in Vigenere ciphers \naccording to my research online. This key successfully decode the message but \nsomething didn't sit right with me. While a random key is a good thing to use in \na real cryptographic application this is a homework assignment so I was expecting \na word as a key. The only way to change the key is to change the shift values of\neach letter. So I tried this. Rather than 'a' being a shift of 1 and 'z' a shift \nof 26 (this can be thought of as a shift of 0 due to the circular nature of the \nalphabet) I tried it with 'a' being a shift of 0 and 'z' being a shift of 25. \nChanging the shift like this means that all the letters in the key should be one \nletter higher in the alphabet so 'a' becomes 'b', 'b' becomes 'c', and so forth. \nWith this change the key becomes 'bellaso' this is the last name of the original \ninventor of the Vigenere Cipher so it makes a lot of sense as a key. After I \nfound 'bellaso' as the key I edited my program to use this new decoding shift \ndistances. The message still decoded properly so this seems to be the correct \nkey. \n\nHomework 2 for CS 1653 at The University of Pittsburgh with Dr. Garrison.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fblester125%2Fkasiski_examination","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fblester125%2Fkasiski_examination","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fblester125%2Fkasiski_examination/lists"}