{"id":16793561,"url":"https://github.com/mdp/four_bites_aes","last_synced_at":"2025-03-17T02:23:56.005Z","repository":{"id":66279394,"uuid":"417037","full_name":"mdp/four_bites_aes","owner":"mdp","description":"A cipher for encoding 4 byte integers - i.e. Obfuscate your MySQL record id's","archived":false,"fork":false,"pushed_at":"2009-12-10T14:47:31.000Z","size":88,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-01-23T12:14:56.345Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Ruby","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/mdp.png","metadata":{"files":{"readme":"README.markdown","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":"2009-12-10T14:46:24.000Z","updated_at":"2013-10-17T19:31:39.000Z","dependencies_parsed_at":"2023-02-20T01:30:41.214Z","dependency_job_id":null,"html_url":"https://github.com/mdp/four_bites_aes","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/mdp%2Ffour_bites_aes","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mdp%2Ffour_bites_aes/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mdp%2Ffour_bites_aes/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mdp%2Ffour_bites_aes/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mdp","download_url":"https://codeload.github.com/mdp/four_bites_aes/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243960636,"owners_count":20375107,"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":"2024-10-13T08:49:39.003Z","updated_at":"2025-03-17T02:23:55.985Z","avatar_url":"https://github.com/mdp.png","language":"Ruby","funding_links":[],"categories":[],"sub_categories":[],"readme":"Four Bites AES\n==============\nAuthor: Mark Percival  \nEmail: mark@mpercival.com  \nCopyright: Mark Percival 2008  \nLicense: MIT \n\n-----------\n\nThis is a simple library that takes any 4 byte integer and encrypts it with a modified version of AES.\nIt's designed with URL shorteners in mind, where brevity is key, and security through obscurity is OK.\n\nTwo goals with this project\n\n- Keep the total number of records somewhat secret\n- Prevent people from easily guessing the next record\n\nmySQL integers are 4 bytes long, so I wanted to account for that, and keep the encrypted number the same length.\n\nI certainly wouldn't base my security on this system.\n\nThis library isn't designed to prevent sophisticated attacks. It's simple designed to keep your total record count\nsecret, and prevent the average joe/jane from easily guessing the next number, all in the shortest \npossible manner.\n\n\n### Details about the code\n\nI followed the AES standard as much as possible, except I used 8 rounds, and a 256 bit unexpanded key. The ShiftRows\nmethod became a rotation of the 4 bytes, and the MixColumns became one single column mix. Other than that, it's essentially \nthe same algorithm.\n\n## Example code\n\n        class Link \u003c ActiveRecord::Base\n          require 'four_bites_aes'\n\n          def to_param\n            @crypte.encode(self.id)\n          end\n        \n          def find_by_aes_id(id)\n            self.find(@crypter.decode(id))\n          end\n        \n          def encoder\n            @crypter ||= FourBitesAES.new(\"supersecret\")\n          end\n\n        end","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmdp%2Ffour_bites_aes","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmdp%2Ffour_bites_aes","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmdp%2Ffour_bites_aes/lists"}