{"id":21586073,"url":"https://github.com/magiclen/ts-short-crypt","last_synced_at":"2025-04-10T20:20:23.121Z","repository":{"id":57358784,"uuid":"371633394","full_name":"magiclen/ts-short-crypt","owner":"magiclen","description":"ShortCrypt is a very simple encryption library, which aims to encrypt any data into something random at first glance.","archived":false,"fork":false,"pushed_at":"2024-10-22T03:29:54.000Z","size":775,"stargazers_count":8,"open_issues_count":0,"forks_count":3,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-24T17:55:20.884Z","etag":null,"topics":["short-crypt","typescript"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/magiclen.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":"2021-05-28T08:29:32.000Z","updated_at":"2025-03-04T10:09:59.000Z","dependencies_parsed_at":"2024-10-22T10:19:46.607Z","dependency_job_id":null,"html_url":"https://github.com/magiclen/ts-short-crypt","commit_stats":{"total_commits":43,"total_committers":2,"mean_commits":21.5,"dds":"0.023255813953488413","last_synced_commit":"e728658a78bb575d11455ff7f4dd7b7325c49c0d"},"previous_names":[],"tags_count":30,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/magiclen%2Fts-short-crypt","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/magiclen%2Fts-short-crypt/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/magiclen%2Fts-short-crypt/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/magiclen%2Fts-short-crypt/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/magiclen","download_url":"https://codeload.github.com/magiclen/ts-short-crypt/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248289805,"owners_count":21078921,"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":["short-crypt","typescript"],"created_at":"2024-11-24T15:12:35.292Z","updated_at":"2025-04-10T20:20:23.099Z","avatar_url":"https://github.com/magiclen.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"ShortCrypt\n====================\n\n[![CI](https://github.com/magiclen/ts-short-crypt/actions/workflows/ci.yml/badge.svg)](https://github.com/magiclen/ts-short-crypt/actions/workflows/ci.yml)\n\nShortCrypt is a very simple encryption library, which aims to encrypt any data into something random at first glance. Even if these data are similar, the ciphers are still pretty different. The most important thing is that a cipher is only **4 bits** larger than its plaintext so that it is suitable for data used in an URL or a QR Code. Besides these, it is also an ideal candidate for serial number generation.\n\n## Usage\n\n```typescript\nimport { ShortCrypt } from \"short-crypt\";\n```\n\nThen, create a `ShortCrypt` instance with a key (string).\n\n```javascript\nconst sc = new ShortCrypt(key);\n```\n\nFor encryption, you can choose to use one of these following methods:\n\n* `encrypt`: encrypts data to an object, a cipher separated into **base** and **body**\n* `encryptToURLComponent`: encrypts data to a string suitably concatenated with URLs\n* `encryptToQRCodeAlphanumeric`: encrypts data to a string with the compatibility with QR code alphanumeric mode\n\nOnly a string or a byte array can be encrypted.\n\n```javascript\nconst cipher1 = sc.encryptToURLComponent(plainText);\nconst cipher2 = sc.encryptToQRCodeAlphanumeric(plainText);\n```\n\nFor decryption, you can use `decrypt`, `decryptURLComponent`, or `decryptQRCodeAlphanumeric` method.\n\n```javascript\nconst result1 = sc.decryptURLComponent(cipher1);\nconst result2 = sc.decryptQRCodeAlphanumeric(cipher2);\n```\n\n## Usage for Browsers\n\n[Source](demo.html)\n\n[Demo Page](https://rawcdn.githack.com/magiclen/ts-short-crypt/master/demo.html)\n\n## License\n\n[MIT](LICENSE)","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmagiclen%2Fts-short-crypt","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmagiclen%2Fts-short-crypt","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmagiclen%2Fts-short-crypt/lists"}