{"id":24494695,"url":"https://github.com/bwca/package_shift-cipher","last_synced_at":"2025-03-15T04:42:04.555Z","repository":{"id":47729827,"uuid":"260534930","full_name":"Bwca/package_shift-cipher","owner":"Bwca","description":"Simple Caesar cipher-like package for encoding for fun","archived":false,"fork":false,"pushed_at":"2021-08-16T09:20:20.000Z","size":128,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2024-04-23T14:43:23.424Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"TypeScript","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/Bwca.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":"2020-05-01T18:52:00.000Z","updated_at":"2022-07-30T16:18:31.000Z","dependencies_parsed_at":"2022-08-24T13:37:26.559Z","dependency_job_id":null,"html_url":"https://github.com/Bwca/package_shift-cipher","commit_stats":null,"previous_names":["bwca/caesar-cipher"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Bwca%2Fpackage_shift-cipher","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Bwca%2Fpackage_shift-cipher/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Bwca%2Fpackage_shift-cipher/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Bwca%2Fpackage_shift-cipher/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Bwca","download_url":"https://codeload.github.com/Bwca/package_shift-cipher/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243685528,"owners_count":20330980,"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-21T20:16:53.864Z","updated_at":"2025-03-15T04:42:04.532Z","avatar_url":"https://github.com/Bwca.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Shift cipher\n\nA simple package for encrypting and decrypting strings using Caesar cipher-like technique.\n\n## How does it work\n\nInstall it from npm using your preferred package manager, i.e.:\n\n```\nnpm install shift-cipher\n```\n\nImport it and create a new shift cipher class:\n\n```\nimport { ShiftCipher } from 'shift-cipher';\n\nconst cipher = new ShiftCipher();\n```\n\nBy default the cipher uses letters of the English alphabet and 13 characters shift.\n\nStrings are encrypted by passing a text string to the **encode** method of the cipher object:\n\n```\n\nconst encryptedString = cipher.encode('Hello');\n\nconsole.log(encryptedString);\n// Uryyb\n```\n\nTo decode simply pass the gibberish you got earlier to the **decode** method:\n\n```\nconst readableString = cipher.decode('Uryyb');\n\nconsole.log(readableString);\n```\n\n## Character set and shift settings\n\nThe character set and the shift can be set by invoking the **makeCipherMap** method and passing it an object with desired settings.\n\nSo you have total control over what characters are encoded and using what shift.\n\nThus you can either completely switch encoded alphabet, or pick which letters will be encoded, i.e. code below encodes only vowels with a shift of 1:\n\n```\ncipher.makeCipherMap({\n  chars: 'aioue',\n  shift: 1,\n});\n\nconst encryptedString = cipher.encode('Hello');\n\nconsole.log(encryptedString);\n// Hallu\n```\n\nThe code snippet below changes whole alphabet, so the shift can be used with the set of Cyrillic characters in Ukrainian:\n\n```\ncipher.makeCipherMap({\n  chars: 'абвгґдеєжзиіїйклмнопрстуфхцчшщьюя',\n  shift: 13,\n});\n```\n\nNote that characters should be in lower case (the function takes care of uppercasing) and should not contain duplicates.\n\nIt is intentionally not fool proof against undefined, nulls and wrong types.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbwca%2Fpackage_shift-cipher","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbwca%2Fpackage_shift-cipher","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbwca%2Fpackage_shift-cipher/lists"}