{"id":20330029,"url":"https://github.com/lakshagg/insane-encrypt","last_synced_at":"2026-06-19T18:32:44.114Z","repository":{"id":54334844,"uuid":"521683420","full_name":"LakshAgg/Insane-Encrypt","owner":"LakshAgg","description":"A simple 256 byte encryption algorithm. feedback needed","archived":false,"fork":false,"pushed_at":"2022-11-30T13:57:02.000Z","size":21,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-04T12:22:45.040Z","etag":null,"topics":["c","cryptography","encryption","encryption-algorithms","encryption-decryption","symmetric-encryption","symmetric-key-cryptography"],"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/LakshAgg.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}},"created_at":"2022-08-05T15:12:30.000Z","updated_at":"2024-01-01T05:53:07.000Z","dependencies_parsed_at":"2023-01-22T01:45:56.614Z","dependency_job_id":null,"html_url":"https://github.com/LakshAgg/Insane-Encrypt","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/LakshAgg/Insane-Encrypt","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LakshAgg%2FInsane-Encrypt","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LakshAgg%2FInsane-Encrypt/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LakshAgg%2FInsane-Encrypt/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LakshAgg%2FInsane-Encrypt/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/LakshAgg","download_url":"https://codeload.github.com/LakshAgg/Insane-Encrypt/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LakshAgg%2FInsane-Encrypt/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":34544403,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-06-19T02:00:06.005Z","response_time":61,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"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":["c","cryptography","encryption","encryption-algorithms","encryption-decryption","symmetric-encryption","symmetric-key-cryptography"],"created_at":"2024-11-14T20:14:41.991Z","updated_at":"2026-06-19T18:32:44.099Z","avatar_url":"https://github.com/LakshAgg.png","language":"C","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Insane Encrypt\nThis is a simple encryption algorithm which uses a 256 byte key. This algorithms might not be 100% secure, so don't use this in production.\n\n# How to use it\n## Generate a random key\nYou can generate a random key by using generate_key from Key/Key.h. You need to specify the pseudo random number generator by passing its pointer to generate_key;\n\n## Encrypt / Decrypt\nData can be encrypted/decrypted by using iencrypt/idecrypt from Encrypt.h\n\n## Save the key\nThe key's important part is key-\u003emap (256 bytes). This can be stored in a file or wherever you want.\n\nYou can use get_key function to get map allocated on heap (You need to free it!).\n\n## Load key\nThe load key function takes the map part and loads everything.\n\n## Verify Key\nThe verify_key function takes the key and checks it's paramters. It returns false if key's variables are invalid.\n\n# How does it work\n***Note: everytime a random number is required it uses random() with seed set to the hash value of the key.***\n\nThe data is encrypted in several steps:\n1. During step 2 several random numbers will be used. All those are allocated on heap. \n2. \u003cdetails\u003e\n    \u003csummary\u003eFor encryption: \u003c/summary\u003e\n\n    The data is encrypted n times. where n is random number of operations:\n    * Generate random numbers by repeatedly calling gen_random_numbers.\n    * map each byte using the key-\u003emap. Every byte is replaced by key-\u003emap[byte].\n    * shuffle the data.\n    * add_xor is called\n    * shuffle the data.\n    \u003c/details\u003e\n\u003cdetails\u003e\n    \u003csummary\u003eFor Decryption:\u003c/summary\u003e\n\n    Decryption is exact opposite of encryption. All the random numbers used previously are used in reverse order.\n\u003c/details\u003e\n\n## How does it work (Detailed)\n\u003cdetails\u003e\n    \u003csummary\u003eMap\u003c/summary\u003e\n\n    Each byte is replaced with the byte which is at that index in key-\u003emap[]. \n    eg: if key-\u003emap = [30, 138, 47, 123, ...]\n    0 is replaced by 30, 1 by 138 and so on.\n\u003c/details\u003e\n\n\u003cdetails\u003e\n    \u003csummary\u003eUnmap\u003c/summary\u003e\n    \n    Each byte is replaced with the byte which is at that index in key-\u003eunmap[].\n\u003c/details\u003e\n\n\u003cdetails\u003e\n    \u003csummary\u003eShuffle\u003c/summary\u003e\n\n    To shuffle the data, it is divided into segments of random length between key-\u003emin_row_size and key-\u003emax_row_size (it does not form a square! number of column may be more or less). Each segment is called a row here. The last row might contain less bytes than the other rows if (data_length % row size != 0).\n\n    Shuffle has the following steps:\n    1. shuffle rows by calling shuffle_row\n    2. swap rows: Swap each row with a random row.\n    3. shuffle columns by callong shuffle_clmn\n    4. every byte is swapped with a random byte from the data.\n\u003c/details\u003e\n\n\n\u003cdetails\u003e\n    \u003csummary\u003eshuffle_row\u003c/summary\u003e\n\n    It shifts the data in the row by a random number.\n\u003c/details\u003e\n\n\n\u003cdetails\u003e\n    \u003csummary\u003eshuffle_clmn\u003c/summary\u003e\n\n    It shifts the data at a specific index from each row.\n\u003c/details\u003e\n\n\n\u003cdetails\u003e\n    \u003csummary\u003eadd_xor\u003c/summary\u003e\n\n    1. A variable s is defined as key-\u003emap[random index];\n    2. Each (except last) byte (i'th byte; i is index of byte in data array) is XORed to j'th byte of key-\u003emap[256]. Where j = (i + s + next byte of data) % 256; \n       Then ((s + i) % 256)'th byte of key-\u003emap is added to it.\n    3. Last byte is XORed and added using key-\u003emap[s] byte.\n\n\u003c/details\u003e\n\n\n\u003cdetails\u003e\n    \u003csummary\u003esub_xor\u003c/summary\u003e\n\n    exact opposite of add_xor.\n\u003c/details\u003e","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flakshagg%2Finsane-encrypt","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flakshagg%2Finsane-encrypt","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flakshagg%2Finsane-encrypt/lists"}