{"id":24122176,"url":"https://github.com/tlinden/twenty4","last_synced_at":"2025-09-04T19:25:23.283Z","repository":{"id":144613112,"uuid":"41759905","full_name":"TLINDEN/twenty4","owner":"TLINDEN","description":"TWENTY4 - fun stream cipher","archived":false,"fork":false,"pushed_at":"2017-05-12T07:15:24.000Z","size":215,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-01-11T11:41:50.649Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"C","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"cc0-1.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/TLINDEN.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","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}},"created_at":"2015-09-01T19:54:42.000Z","updated_at":"2017-05-09T22:58:35.000Z","dependencies_parsed_at":null,"dependency_job_id":"0163a6a9-8bcb-461b-ae66-76a849a457c5","html_url":"https://github.com/TLINDEN/twenty4","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TLINDEN%2Ftwenty4","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TLINDEN%2Ftwenty4/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TLINDEN%2Ftwenty4/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TLINDEN%2Ftwenty4/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/TLINDEN","download_url":"https://codeload.github.com/TLINDEN/twenty4/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":241210936,"owners_count":19927817,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","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":[],"created_at":"2025-01-11T11:38:46.029Z","updated_at":"2025-02-28T19:24:33.510Z","avatar_url":"https://github.com/TLINDEN.png","language":"C","funding_links":[],"categories":[],"sub_categories":[],"readme":"## TWENTY4/160 - a fun stream cipher\n\n*THIS IS JUST FOR LEARINING CRYPTO, DO NOT EVER USE THIS FOR ANYTHING*\n\nThis is the implementation of the fun stream cipher TWENTY4/160 by T.v. Dein, 09/2015.\nPublished under the public domain, Creative Commons Zero License. It works bytewise,\nuses a 160 bit key in 8 rounds including an S-Box. A random nonce is added for more\nsecurity as IV, each output byte is used as the next IV (like CBC mode). From the key\nvarious PRNGs are seeded, all those PRNGs are recombined into an output key stream,\nwhich is being xored with the IV and then applied to the sbox; the result is then xored\nwith the input..\n\nThe name TWENTY4 is a reference to article 20 paragraph 4 of the german constitution\nwhich reads:\n\n\u003e All Germans shall have  the right to resist  any person seeking to\n\u003e abolish this constitutional order, if no other remedy is available.\n\nAlso, the cipher uses the contents of the german constitution as the source for its\nS-Box.\n\n## S-Box generation\n\nTWENTY4 uses the german constitution (called \"basic law\" in germany) as\nthe source for S-Boxes. The EPUB version (included in sbox/ subdir)\nis encrypted using AES-256-CBC with the passphrase\n\"grundgesetz\\n\". The resulting byte stream is used as the source for\nS-Boxes.\n\nThe following version of the german constitution is used:\n\nBasic Law for the Federal Republic of Germany in the revised version\npublished in the Federal Law Gazette Part III, classification number\n100-1, as last amended by the Act of 23 December 2014\n(Federal Law Gazette I p. 2438).\n\nLinux Shell commands to generate the S-Boxes:\n\n    curl -o BJNR000010949.epub http://www.gesetze-im-internet.de/gg/BJNR000010949.epub\n    echo grundgesetz \u003e BJNR000010949.pass\n    cat BJNR000010949.epub | openssl aes-256-cbc -kfile BJNR000010949.pass | ./gen-static-sbox\n\n'gen-static-sbox' compiled from gen-static-sbox.c in this directory, which has SHA256\nchecksum: 29bfd8bd6dbca696d4d8b7ca997497e091875d6bf939e9702b1edf669d0742b0.\n\nHowever, it just prints out bytes which it reads from STDIN, collecting them into an 256\nbyte array, ignoring possible duplicates, and prints it out as hex.\n\nThe S-Box is bijective and has the following properties (calculated using analyze.c):\n\n    Char distribution: 100.000000%\n      Char redundancy: 0.000000%\n         Char entropy: 8.000000 bits/char\n     Compression rate: 0.000000%\n\n## Key expansion\n\nFIXME.\n\n## Encryption\n\nFIXME.\n\n## Analysis so far\n\nWhile this stuff only exists for me to play around with\ncrypto, I tried to test the cipher a little bit. Here are\nmy results using a couple of statistical measurements:\n\nI encrypted the GPLv3 contents using the key \"1\". To compare,\nI encrypted the same file with AES-256-CBC using the same\npassphrase.\n\nFor results look in analyze/TESTLOG.md.\n\nSo, all those checks don't look that bad, but of course this doesn't\nsay much about TWENTY4/160's security. However, not THAT bad for the first cipher :)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftlinden%2Ftwenty4","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftlinden%2Ftwenty4","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftlinden%2Ftwenty4/lists"}