{"id":19139896,"url":"https://github.com/arcblock/mcrypto","last_synced_at":"2025-05-06T23:16:28.525Z","repository":{"id":57522056,"uuid":"168175085","full_name":"ArcBlock/mcrypto","owner":"ArcBlock","description":"Multiple crypto-graphical algorithm support.","archived":false,"fork":false,"pushed_at":"2019-07-05T05:58:25.000Z","size":35,"stargazers_count":8,"open_issues_count":3,"forks_count":1,"subscribers_count":23,"default_branch":"master","last_synced_at":"2025-05-06T23:16:23.175Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Elixir","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/ArcBlock.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","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":"2019-01-29T15:10:06.000Z","updated_at":"2024-10-28T18:37:42.000Z","dependencies_parsed_at":"2022-08-26T23:41:01.528Z","dependency_job_id":null,"html_url":"https://github.com/ArcBlock/mcrypto","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ArcBlock%2Fmcrypto","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ArcBlock%2Fmcrypto/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ArcBlock%2Fmcrypto/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ArcBlock%2Fmcrypto/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ArcBlock","download_url":"https://codeload.github.com/ArcBlock/mcrypto/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":252782835,"owners_count":21803410,"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-11-09T07:15:36.789Z","updated_at":"2025-05-06T23:16:28.508Z","avatar_url":"https://github.com/ArcBlock.png","language":"Elixir","funding_links":[],"categories":[],"sub_categories":[],"readme":"![mcrypto](https://www.arcblock.io/.netlify/functions/badge/?text=Mcrypto)\n\nMultiple crypto functionalities support.\n\n## Hash\n\nHash functions support:\n\n- SHA2\n- SHA3 (the NIST SHA3 winner keccak)\n- Keccakf1600 (the original keccak before NIST SHA3)\n- Blake2b\n\nFor each type, it supports:\n\n- `size`: the output size of the hash function\n- `round`: rounds of hash\n\nRefer to `lib/mcrypto/hasher/#{type}.ex` for default values.\n\n```\niex(1)\u003e Mcrypto.Hasher.hash(%Mcrypto.Hasher.Sha2{}, \"123\")\n\u003c\u003c90, 119, 209, 233, 97, 45, 53, 11, 55, 52, 246, 40, 34, 89, 183, 255, 10, 63,\n  135, 214, 44, 254, 245, 243, 94, 145, 165, 96, 76, 4, 144, 163\u003e\u003e\n\niex(2)\u003e Mcrypto.Hasher.hash(%Mcrypto.Hasher.Sha3{}, \"123\")\n\u003c\u003c160, 58, 177, 155, 134, 111, 197, 133, 181, 203, 24, 18, 162, 246, 60, 168,\n  97, 231, 231, 100, 62, 229, 212, 63, 215, 16, 107, 98, 55, 37, 253, 103\u003e\u003e\n\niex(3)\u003e Mcrypto.Hasher.hash(%Mcrypto.Hasher.Keccak{}, \"123\")\n\u003c\u003c100, 230, 4, 120, 124, 191, 25, 72, 65, 231, 182, 141, 124, 210, 135, 134,\n  246, 201, 160, 163, 171, 159, 139, 10, 14, 135, 203, 67, 135, 171, 1, 7\u003e\u003e\n\niex(4)\u003e Mcrypto.Hasher.hash(%Mcrypto.Hasher.Blake2b{}, \"123\")\n\u003c\u003c245, 214, 123, 174, 115, 176, 225, 13, 13, 253, 48, 67, 179, 244, 241, 0, 173,\n  160, 20, 197, 195, 123, 213, 206, 151, 129, 59, 19, 245, 171, 43, 207\u003e\u003e\n\niex(5)\u003e Mcrypto.Hasher.hash(%Mcrypto.Hasher.Sha3{round: 2}, \"123\")\n\u003c\u003c178, 166, 47, 187, 14, 183, 128, 107, 24, 76, 153, 89, 4, 151, 121, 57, 83,\n  110, 61, 68, 212, 129, 77, 183, 155, 89, 119, 84, 133, 8, 147, 108\u003e\u003e\n```\n\n## Signer\n\nSigner functions support:\n\n- Ed25519\n- secp256k1\n\n```\niex(1)\u003e {pk, sk} = Mcrypto.Signer.keypair(%Mcrypto.Signer.Ed25519{})\n{\u003c\u003c232, 40, 152, 168, 166, 80, 64, 142, 82, 105, 2, 147, 80, 38, 228, 179, 50,\n   188, 2, 216, 53, 205, 99, 1, 189, 206, 7, 223, 18, 197, 78, 254\u003e\u003e,\n \u003c\u003c24, 50, 129, 21, 98, 11, 117, 213, 137, 137, 26, 145, 99, 21, 50, 37, 125,\n   147, 12, 81, 33, 233, 58, 17, 13, 125, 86, 77, 199, 116, 104, 222, 232, 40,\n   152, 168, 166, 80, 64, 142, 82, 105, 2, 147, 80, 38, 228, 179, ...\u003e\u003e}\n\niex(2)\u003e sig = Mcrypto.Signer.sign!(%Mcrypto.Signer.Ed25519{}, \"123\", sk)\n\u003c\u003c19, 145, 10, 186, 226, 92, 99, 83, 14, 41, 144, 63, 68, 161, 107, 184, 186,\n  181, 252, 248, 246, 236, 170, 64, 199, 163, 175, 197, 113, 217, 6, 211, 113,\n  64, 251, 180, 253, 147, 106, 31, 51, 244, 184, 74, 182, 49, 13, 170, 174, 164,\n  ...\u003e\u003e\n\niex(3)\u003e Mcrypto.Signer.verify(%Mcrypto.Signer.Ed25519{}, \"123\", sig, pk)\ntrue\n```\n\n## Crypter\n\nCrypter functions support:\n\n- AES CBC 256 mode\n\nFor each type, it supports:\n\n- `encoder`: `:base64` or `nil`. The encoding method for the result.\n\n```\niex(1)\u003e [iv: iv, ciphertext: ct] = Mcrypto.Crypter.encrypt(%Mcrypto.Crypter.AES{}, \"123\", \"password\")\n[iv: \"MQgRmTS8JIzX3EP1u2PEqQ==\", ciphertext: \"HsX6fxHqRUvLNueihOorUA==\"]\n\niex(2)\u003e Mcrypto.Crypter.decrypt(%Mcrypto.Crypter.AES{}, ct, \"password\", iv)\n\"123\"\n\niex(3)\u003e [iv: iv, ciphertext: ct] = Mcrypto.Crypter.encrypt(%Mcrypto.Crypter.AES{encoder: nil}, \"123\", \"password\")\n[\n  iv: \u003c\u003c136, 31, 159, 34, 254, 185, 17, 13, 53, 92, 89, 51, 254, 86, 196, 112\u003e\u003e,\n  ciphertext: \u003c\u003c114, 43, 113, 13, 227, 87, 156, 126, 55, 101, 126, 236, 146,\n    229, 75, 67\u003e\u003e\n]\n\niex(4)\u003e Mcrypto.Crypter.decrypt(%Mcrypto.Crypter.AES{encoder: nil}, ct, \"password\", iv)\n\"123\"\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Farcblock%2Fmcrypto","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Farcblock%2Fmcrypto","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Farcblock%2Fmcrypto/lists"}