{"id":17127991,"url":"https://github.com/rohanrhu/catcrypt","last_synced_at":"2026-05-04T04:32:32.020Z","repository":{"id":218644294,"uuid":"746251634","full_name":"rohanrhu/catcrypt","owner":"rohanrhu","description":"Simple RSA public key encryption library for C/C++.","archived":false,"fork":false,"pushed_at":"2024-05-01T16:41:16.000Z","size":4544,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-10-20T00:43:24.296Z","etag":null,"topics":["c","cpp","encryption","public-key-cryptography","public-key-infrastructure","rsa"],"latest_commit_sha":null,"homepage":"","language":"C","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/rohanrhu.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}},"created_at":"2024-01-21T14:23:50.000Z","updated_at":"2024-05-01T16:41:19.000Z","dependencies_parsed_at":"2024-01-27T16:45:21.724Z","dependency_job_id":null,"html_url":"https://github.com/rohanrhu/catcrypt","commit_stats":null,"previous_names":["rohanrhu/catcrypt"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/rohanrhu/catcrypt","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rohanrhu%2Fcatcrypt","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rohanrhu%2Fcatcrypt/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rohanrhu%2Fcatcrypt/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rohanrhu%2Fcatcrypt/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/rohanrhu","download_url":"https://codeload.github.com/rohanrhu/catcrypt/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rohanrhu%2Fcatcrypt/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32595124,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-03T22:12:39.696Z","status":"online","status_checked_at":"2026-05-04T02:00:06.625Z","response_time":58,"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","cpp","encryption","public-key-cryptography","public-key-infrastructure","rsa"],"created_at":"2024-10-14T19:05:58.635Z","updated_at":"2026-05-04T04:32:32.005Z","avatar_url":"https://github.com/rohanrhu.png","language":"C","funding_links":["https://patreon.com/EvrenselKisilik"],"categories":[],"sub_categories":[],"readme":"# Meowing Cat's RSA/PKE implementation (Catcrypt)\n\n[![GitHub issues](https://img.shields.io/github/issues/rohanrhu/catcrypt?style=flat-square\u0026color=red)](https://github.com/rohanrhu/catcrypt/issues)\n[![GitHub forks](https://img.shields.io/github/forks/rohanrhu/catcrypt?style=flat-square)](https://github.com/rohanrhu/catcrypt/network)\n[![GitHub stars](https://img.shields.io/github/stars/rohanrhu/catcrypt?style=flat-square)](https://github.com/rohanrhu/catcrypt/stargazers)\n[![Support me on Patreon](https://img.shields.io/endpoint.svg?url=https%3A%2F%2Fshieldsio-patreon.vercel.app%2Fapi%3Fusername%3DEvrenselKisilik%26type%3Dpatrons\u0026style=flat-square)](https://patreon.com/EvrenselKisilik)\n[![Donate with BTC](https://shields.io/badge/donate-bc1qhvlc762kwuzeawedl9a8z0duhs8449nwwc35e2-yellow?logo=bitcoin\u0026style=flat-square)](#donate)\n\nSimple RSA public key encryption library for C/C++.\n\n## Features\n\nCatcrypt can do these:\n\n* Generating RSA keypairs\n* Exporting RSA keys as HEX representations\n* Importing RSA keys from HEX\n* Encrypting data\n* Decrypting data\n* Signing data\n* Exporting signatures into string\n* Importing signatures from string\n* Verifying data by signature\n\n## How it works?\n\nJump to the [Example](#example) if you wanna be quick.\n\n\u003e [!CAUTION]\n\u003e **Please read this:**\n\u003e This RSA library seems to be safe but THERE IS NO ANY GUARANTEE!\n\u003e The prime number generation seems to be safe enough and impossible (I'M NOT SURE and THERE IS NO ANY GUARANTEE) to break.\n\u003e **Using this library or not is %100 in your responsibility.**\n\nI wrote this library for only signing \u0026 verifying purpose for my game server and\njust wanted to share it as open source by extracting from my game server\nwith some other things like my string and reference counting and referencing implementations.\n\n\u003e [!WARNING]\n\u003e The library uses 2048 bit keys by default.\n\u003e It has a weird \"addition loop\" thing for random prime number generation and I'm not sure if it is better or worse for entropy. (I'll visualize it and see if it is or not.)\n\u003e It uses 65537 for public key exponent.\n\u003e This RSA implementation is not compatible with any other RSA implementation.\n\u003e It uses my own format for encrypted data.\n\n## Build, Link and Use\n\n### Include\n\n```c\n#include \"rsa.h\"\n```\n\n### Building and Linking\n\nYou can just build and link `rsa.o` and use `rsa.h`. Don't forget to use `-O3` flag for compilation.\n\nUsing `make` will build catcrypt and examples:\n\n```bash\ncd /path/to/catcrypt\nmake\ncd /path/to/your/app\ngcc -o app.exe app.c \\\n    /path/to/catcrypt/rsa.o -I /path/to/catcrypt \\\n    ./catcrypt/thirdparty/gmp-6.3.0/.libs/libgmp.a -I ./catcrypt/thirdparty/gmp-6.3.0\n```\n\nYou need to link GNU MP Big Number library too like this ^^.\n\n## Usage and API Reference\n\nHere you can see everything:\n\n```c\n#define CATCRYPT_RSA_PUB_EXPONENT 65537\n#define CATCRYPT_RSA_PRIME_BITS 2048\n#define CATCRYPT_RSA_PRIME_REPS 50\n#define CATCRYPT_RSA_BLOCK_SIZE 128\n\n#define CATCRYPT_MPZ_ENDIAN 1\n#define CATCRYPT_MPZ_ORDER 1\n\ntypedef uint8_t catcrypt_rsa_random_seed_adds_t;\n#define CATCRYPT_RSA_RANDOM_SEED_ADDS_MASK 20 // 1 to 2 ^ ((sizeof(catcrypt_rsa_random_seed_adds_t) * 8) - 1)\n\ntypedef struct catcrypt_rsa_keypair catcrypt_rsa_keypair_t;\ntypedef struct catcrypt_rsa_key catcrypt_rsa_key_t;\ntypedef struct catcrypt_rsa_encrypted catcrypt_rsa_encrypted_t;\n\nstruct catcrypt_rsa_key {\n    REF_COUNTEDIFY();\n    mpz_t e;\n    mpz_t n;\n};\n\nstruct catcrypt_rsa_keypair {\n    REF_COUNTEDIFY();\n    catcrypt_rsa_key_t* pubkey;\n    catcrypt_rsa_key_t* privkey;\n};\n\nstruct catcrypt_rsa_encrypted {\n    REF_COUNTEDIFY();\n    catcrypt_string_t* data;\n    catcrypt_rsa_key_t* key;\n};\n\nuint32_t catcrypt_rsa_hash_h32(char* str);\nuint32_t catcrypt_rsa_hash_h32__n(char* data, ssize_t length);\n\nbool catcrypt_rsa_random_seed(unsigned char* seed, size_t size);\nvoid catcrypt_rsa_random_prime(mpz_t num);\n\ncatcrypt_rsa_key_t* catcrypt_rsa_key_new();\nvoid catcrypt_rsa_key_free(catcrypt_rsa_key_t* key);\ncatcrypt_rsa_keypair_t* catcrypt_rsa_keypair_new();\nvoid catcrypt_rsa_keypair_free(catcrypt_rsa_keypair_t* keypair);\n\ncatcrypt_rsa_encrypted_t* catcrypt_rsa_encrypted_new();\nvoid catcrypt_rsa_encrypted_set_key(catcrypt_rsa_encrypted_t* encrypted, catcrypt_rsa_key_t* key);\nvoid catcrypt_rsa_encrypted_set_data(catcrypt_rsa_encrypted_t* encrypted, catcrypt_string_t* data);\nvoid catcrypt_rsa_encrypted_free(catcrypt_rsa_encrypted_t* encrypted);\ncatcrypt_rsa_encrypted_t* catcrypt_rsa_encrypt(catcrypt_string_t* data, catcrypt_rsa_key_t* pubkey);\ncatcrypt_string_t* catcrypt_rsa_decrypt(catcrypt_rsa_encrypted_t* encrypted, catcrypt_rsa_key_t* privkey);\n\ncatcrypt_string_t* catcrypt_rsa_key_to_bin(catcrypt_rsa_key_t* key);\ncatcrypt_rsa_key_t* catcrypt_rsa_key_from_bin(catcrypt_string_t* hex);\n\ncatcrypt_string_t* catcrypt_rsa_key_to_hex(catcrypt_rsa_key_t* key);\ncatcrypt_rsa_key_t* catcrypt_rsa_key_from_hex(catcrypt_string_t* hex);\n\ncatcrypt_string_t* catcrypt_rsa_sign(catcrypt_string_t* data, catcrypt_rsa_key_t* privkey);\nbool catcrypt_rsa_verify(catcrypt_string_t* data, catcrypt_string_t* signature, catcrypt_rsa_key_t* pubkey);\ncatcrypt_string_t* catcrypt_rsa_signature_to_hex(catcrypt_string_t* signature_bin);\ncatcrypt_string_t* catcrypt_rsa_signature_from_hex(catcrypt_string_t* signature_hex);\n```\n\nIt is easy to understand I think. Please look at the example usage. (`./examples/test`)\n\n## Types (Strings and Reference Counting \u0026 Reference)\n\nActually, I wrote this library for one of my projects and extracted it to make it an independent open source library.\n\nIt has my strings and reference counting and reference system that you can easily understand how it works in the following example.\n\n### Strings (`catcrypt_string_t*`)\n\nYou can see string things here:\n\n```c\n/**\n * ! Free by ref counting\n */\ntypedef struct catcrypt_string {\n    char* value;\n    unsigned int size;\n    unsigned int length;\n    unsigned int is_alloc_str;\n    catcrypt_ref_counted_t ref_counted;\n} catcrypt_string_t;\n\ncatcrypt_string_t* catcrypt_string_new();\ncatcrypt_string_t* catcrypt_string_new__n(int length);\ncatcrypt_string_t catcrypt_string_from_cstr__copy(char* cstr, ssize_t length);\ncatcrypt_string_t* catcrypt_string_new_from_cstr__copy(char* cstr, ssize_t length);\ncatcrypt_string_t* catcrypt_string_new_from_binary__copy(char* data, ssize_t length);\ncatcrypt_string_t catcrypt_string_from_cstr(char* cstr, ssize_t length);\ncatcrypt_string_t catcrypt_string_from_binary(char* data, ssize_t length);\ncatcrypt_string_t* catcrypt_string_new_from_cstr(char* cstr, ssize_t length);\nvoid catcrypt_string_free(catcrypt_string_t* string);\nvoid catcrypt_string_set_value(catcrypt_string_t* string, char* value);\nvoid catcrypt_string_set_value__n(catcrypt_string_t* string, char* value, size_t length);\nvoid catcrypt_string_append__cstr__n(catcrypt_string_t* string, char* value, ssize_t length);\n\nbool catcrypt_string_compare(catcrypt_string_t* string, catcrypt_string_t* other);\n```\n\n### Reference Counting (`catcrypt_ref_counted_t*`, `catcrypt_ref_t*`)\n\nMy reference counting has reference counted type (``catcrypt_ref_counted_t*``) which this library only uses but also it has a reference system too.\n\n```c\ntypedef void (*catcrypt_ref_free_f_t)(void*);\n\n#define CATCRYPT_REF_COUNTED_INIT(obj, free_f) \\\n    catcrypt_ref_counted_init(\u0026(obj-\u003eref_counted), (catcrypt_ref_free_f_t) free_f);\n\n#define CATCRYPT_REF_COUNTED_USE(obj) \\\n    catcrypt_util_verbose(\"Referencing: %s\\n\", #obj); \\\n    \\\n    catcrypt_ref_counted_use(\u0026(obj-\u003eref_counted));\n\n#define CATCRYPT_REF_COUNTED_LEAVE(obj) \\\n    catcrypt_util_verbose(\"Dereferencing: %s\\n\", #obj); \\\n    \\\n    if (obj != NULL) { \\\n        catcrypt_ref_counted_leave((void **) (\u0026(obj)), \u0026(obj-\u003eref_counted)); \\\n    }\n\n#define REF_COUNTEDIFY() \\\n    catcrypt_ref_counted_t ref_counted;\n#define CATCRYPT_REF_BY(name) name##_ref\n#define CATCRYPT_REF(type, name) \\\n    type name; \\\n    catcrypt_ref_t* CATCRYPT_REF_BY(name);\n#define CATCRYPT_REF_NEW(path, expr) \\\n    path = expr; \\\n    CATCRYPT_REF_BY(path) = catcrypt_ref_new((void *) path, \u0026(path-\u003eref_counted));\n#define CATCRYPT_REF_ASSIGN(var, val) \\\n    catcrypt_ref_assign(\u0026(CATCRYPT_REF_BY(var)), \u0026(CATCRYPT_REF_BY(val))); \\\n    var = val;\n#define CATCRYPT_REF_SET(ref, obj) \\\n    ref = obj; \\\n    catcrypt_ref_set(CATCRYPT_REF_BY(ref), (void *) (ref));\n#define CATCRYPT_REF_USE(name) catcrypt_ref_use(CATCRYPT_REF_BY(name));\n#define CATCRYPT_REF_LEAVE(name) catcrypt_ref_leave(\u0026(CATCRYPT_REF_BY(name)));\n#define CATCRYPT_REF_ARG(type, name) type name, catcrypt_ref_t* name##_ref\n#define CATCRYPT_REF_PASS(name) catcrypt_ref_new((void *) name, \u0026(name-\u003eref_counted));\n\ntypedef struct catcrypt_ref_counted catcrypt_ref_counted_t;\ntypedef struct catcrypt_ref catcrypt_ref_t;\n\nstruct catcrypt_ref_counted {\n    int count;\n    catcrypt_ref_free_f_t free_f;\n};\n\nstruct catcrypt_ref {\n    int count;\n    void* obj;\n    catcrypt_ref_counted_t* ref_counted;\n};\n\nvoid catcrypt_ref_counted_init(catcrypt_ref_counted_t* ref_counted, catcrypt_ref_free_f_t free_f);\nvoid catcrypt_ref_counted_use(catcrypt_ref_counted_t* ref_counted);\nvoid catcrypt_ref_counted_leave(void** obj_vp, catcrypt_ref_counted_t* ref_counted);\n\ncatcrypt_ref_t* catcrypt_ref_new(void* obj, catcrypt_ref_counted_t* ref_counted);\nvoid catcrypt_ref_free(catcrypt_ref_t* ref);\nvoid catcrypt_ref_use(catcrypt_ref_t* ref);\nvoid catcrypt_ref_leave(catcrypt_ref_t** ref);\nvoid catcrypt_ref_assign(catcrypt_ref_t** dst, catcrypt_ref_t** src);\nvoid catcrypt_ref_set(catcrypt_ref_t* ref, void* obj);\n```\n\n## Example\n\n```c\n#include \u003cstdio.h\u003e\n\n#include \"../../include/rsa.h\"\n\nint main() {\n    char* data_to_encrypt = \"Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum. Sed no sumo stet, est ei quodsi feugait liberavisse, in pro quot facete definitiones. Vivendum intellegat et qui, ei denique consequuntur vix. Offendit eleifend moderatius ex vix, quem odio mazim et qui, purto expetendis cotidieque quo cu, veri persius vituperata ei nec. Partiendo adversarium no mea. Offendit eleifend moderatius ex vix, quem odio mazim et qui, purto expetendis cotidieque quo cu, veri persius vituperata ei nec. Qui gloriatur scribentur et, id velit verear mel, cum no porro debet. Sit fugit nostrum et. Offendit eleifend moderatius ex vix, quem odio mazim et qui, purto expetendis cotidieque quo cu, veri persius vituperata ei nec. Pro ea animal dolores. Scripta periculis ei eam, te pro movet reformidans. Soluta facilisi instructior eam in, ferri oratio ancillae te ius. Vivendum intellegat et qui, ei denique consequuntur vix.\";\n\n    printf(\"Generating key pair...\\n\");\n\n    catcrypt_string_t* data_to_encrypt_str = catcrypt_string_new_from_cstr(data_to_encrypt, strlen(data_to_encrypt)); CATCRYPT_REF_COUNTED_USE(data_to_encrypt_str);\n\n    catcrypt_rsa_keypair_t* keypair = catcrypt_rsa_keypair_new(); CATCRYPT_REF_COUNTED_USE(keypair);\n    \n    catcrypt_string_t* pubkey_hex = catcrypt_rsa_key_to_hex(keypair-\u003epubkey); CATCRYPT_REF_COUNTED_USE(pubkey_hex);\n    catcrypt_string_t* privkey_hex = catcrypt_rsa_key_to_hex(keypair-\u003eprivkey); CATCRYPT_REF_COUNTED_USE(privkey_hex);\n\n    catcrypt_rsa_key_t* pubkey_from_hex = catcrypt_rsa_key_from_hex(pubkey_hex); CATCRYPT_REF_COUNTED_USE(pubkey_from_hex);\n    catcrypt_rsa_key_t* privkey_from_hex = catcrypt_rsa_key_from_hex(privkey_hex); CATCRYPT_REF_COUNTED_USE(privkey_from_hex);\n    catcrypt_string_t* pubkey_from_hex_to_hex = catcrypt_rsa_key_to_hex(pubkey_from_hex); CATCRYPT_REF_COUNTED_USE(pubkey_from_hex_to_hex);\n    catcrypt_string_t* privkey_from_hex_to_hex = catcrypt_rsa_key_to_hex(privkey_from_hex); CATCRYPT_REF_COUNTED_USE(privkey_from_hex_to_hex);\n    \n    catcrypt_rsa_encrypted_t* encrypted = catcrypt_rsa_encrypt(data_to_encrypt_str, pubkey_from_hex); CATCRYPT_REF_COUNTED_USE(encrypted);\n    catcrypt_string_t* decrypted = catcrypt_rsa_decrypt(encrypted, privkey_from_hex); CATCRYPT_REF_COUNTED_USE(decrypted);\n    printf(\"Decrypted: %s\\n\", decrypted-\u003evalue);\n    catcrypt_string_t* signature = catcrypt_rsa_sign(data_to_encrypt_str, keypair-\u003eprivkey); CATCRYPT_REF_COUNTED_USE(signature);\n    catcrypt_string_t* signature_hex = catcrypt_rsa_signature_to_hex(signature); CATCRYPT_REF_COUNTED_USE(signature_hex);\n    printf(\"Signature: %s\\n\", signature_hex-\u003evalue);\n    catcrypt_string_t* signature_from_hex = catcrypt_rsa_signature_from_hex(signature_hex); CATCRYPT_REF_COUNTED_USE(signature_from_hex);\n    \n    bool verified = catcrypt_rsa_verify(data_to_encrypt_str, signature_from_hex, keypair-\u003epubkey);\n    \n    printf(\"Public Key: %s\\n\", pubkey_hex-\u003evalue);\n    printf(\"Private Key: %s\\n\", privkey_hex-\u003evalue);\n    printf(\"Public Key From Hex: %s\\n\", pubkey_from_hex_to_hex-\u003evalue);\n    printf(\"Private Key From Hex: %s\\n\", privkey_from_hex_to_hex-\u003evalue);\n    \n    printf(\"Verified: %d\\n\", verified);\n\n    CATCRYPT_REF_COUNTED_LEAVE(data_to_encrypt_str);\n    CATCRYPT_REF_COUNTED_LEAVE(keypair);\n    CATCRYPT_REF_COUNTED_LEAVE(pubkey_hex);\n    CATCRYPT_REF_COUNTED_LEAVE(privkey_hex);\n    CATCRYPT_REF_COUNTED_LEAVE(pubkey_from_hex);\n    CATCRYPT_REF_COUNTED_LEAVE(privkey_from_hex);\n    CATCRYPT_REF_COUNTED_LEAVE(pubkey_from_hex_to_hex);\n    CATCRYPT_REF_COUNTED_LEAVE(privkey_from_hex_to_hex);\n    CATCRYPT_REF_COUNTED_LEAVE(encrypted);\n    CATCRYPT_REF_COUNTED_LEAVE(decrypted);\n    CATCRYPT_REF_COUNTED_LEAVE(signature);\n    CATCRYPT_REF_COUNTED_LEAVE(signature_hex);\n    CATCRYPT_REF_COUNTED_LEAVE(signature_from_hex);\n    \n    return 0;\n}\n```\n\n## What about my dumb hashing algorithm?\n\nIdk.. I had made it for another project [libhash](https://github.com/rohanrhu/libhash) in a coffee break before. According to my tests, it seems pretty oki and safe.\n\nHere my dumb hash32 algorithm:\n\n```c\nuint32_t catcrypt_rsa_hash_h32__n(char* data, ssize_t length) {\n    uint32_t hash = 0;\n\n    int remaining = 4;\n    int prev = 0;\n\n    for (int i=0; (length == -1) ? (i \u003c length): (data[i] != '\\0'); i++) {\n        remaining--;\n        int c = data[i] \u0026 0b01111111;\n        uint8_t mask = ((c % 255) \u003c\u003c (((((prev % 2) != 0) ? prev: 1) * i * c) % 7));\n        *(((unsigned char *)(\u0026hash)) + ((i * c + prev) % 3)) = ((prev % 2) == 0)\n                                                             ? mask | prev\n                                                             : mask \u0026 prev;\n        prev = (i * c) % 7;\n    }\n\n    for (int i=remaining; i \u003e 0; i--) {\n        *(((unsigned char *)(\u0026hash)) + ((4 - i) % 4)) = data[i % ((4 - i) % (4 - remaining))];\n    }\n\n    return hash;\n}\n```\n\n## Definitions\n\n* `CATCRYPT_RSA_PUB_EXPONENT`: The public exponent used in RSA encryption.\n* `CATCRYPT_RSA_PRIME_BITS`: The number of bits in the prime numbers used for RSA encryption.\n* `CATCRYPT_RSA_PRIME_REPS`: The number of repetitions for the Miller-Rabin primality test.\n* `CATCRYPT_RSA_BLOCK_SIZE`: The block size for RSA encryption.\n\n## Structures\n\n* `catcrypt_rsa_key`: Represents an RSA key.\n* `catcrypt_rsa_keypair`: Represents a pair of RSA keys (public and private).\n* `catcrypt_rsa_encrypted`: Represents encrypted data.\n\n## Functions\n\n### `uint32_t catcrypt_rsa_hash_h32(char* str)`\n\nHashes a string.\n\n### `uint32_t catcrypt_rsa_hash_h32__n(char* data, ssize_t length)`\n\nHashes a data of given length.\n\n### `bool catcrypt_rsa_random_seed(unsigned char* seed, size_t size)`\n\nSeeds the random number generator.\n\n### `void catcrypt_rsa_random_prime(mpz_t num)`\n\nGenerates a random prime number.\n\n### `catcrypt_rsa_key_t* catcrypt_rsa_key_new()`\n\nCreates a new RSA key.\n\n### `void catcrypt_rsa_key_free(catcrypt_rsa_key_t* key)`\n\nFrees an RSA key.\n\n### `catcrypt_rsa_keypair_t* catcrypt_rsa_keypair_new()`\n\nCreates a new RSA key pair.\n\n### `void catcrypt_rsa_keypair_free(catcrypt_rsa_keypair_t* keypair)`\n\nFrees an RSA key pair.\n\n### `catcrypt_rsa_encrypted_t* catcrypt_rsa_encrypted_new()`\n\nCreates a new encrypted data object.\n\n### `void catcrypt_rsa_encrypted_set_key(catcrypt_rsa_encrypted_t* encrypted, catcrypt_rsa_key_t* key)`\n\nSets the key for an encrypted data object.\n\n### `void catcrypt_rsa_encrypted_set_data(catcrypt_rsa_encrypted_t* encrypted, catcrypt_string_t* data)`\n\nSets the data for an encrypted data object.\n\n### `void catcrypt_rsa_encrypted_free(catcrypt_rsa_encrypted_t* encrypted)`\n\nFrees an encrypted data object.\n\n### `catcrypt_rsa_encrypted_t* catcrypt_rsa_encrypt(catcrypt_string_t* data, catcrypt_rsa_key_t* pubkey)`\n\nEncrypts data.\n\n### `catcrypt_string_t* catcrypt_rsa_decrypt(catcrypt_rsa_encrypted_t* encrypted, catcrypt_rsa_key_t* privkey)`\n\nDecrypts data.\n\n### `catcrypt_string_t* catcrypt_rsa_key_to_bin(catcrypt_rsa_key_t* key)`\n\nConverts an RSA key to binary.\n\n### `catcrypt_rsa_key_t* catcrypt_rsa_key_from_bin(catcrypt_string_t* hex)`\n\nConverts binary data to an RSA key.\n\n### `catcrypt_string_t* catcrypt_rsa_key_to_hex(catcrypt_rsa_key_t* key)`\n\nConverts an RSA key to hexadecimal.\n\n### `catcrypt_rsa_key_t* catcrypt_rsa_key_from_hex(catcrypt_string_t* hex)`\n\nConverts hexadecimal data to an RSA key.\n\n### `catcrypt_string_t* catcrypt_rsa_sign(catcrypt_string_t* data, catcrypt_rsa_key_t* privkey)`\n\nSigns data.\n\n### `bool catcrypt_rsa_verify(catcrypt_string_t* data, catcrypt_string_t* signature, catcrypt_rsa_key_t* pubkey)`\n\nVerifies a signature.\n\n### `catcrypt_string_t* catcrypt_rsa_signature_to_hex(catcrypt_string_t* signature_bin)`\n\nConverts a signature to hexadecimal.\n\n### `catcrypt_string_t* catcrypt_rsa_signature_from_hex(catcrypt_string_t* signature_hex)`\n\nConverts hexadecimal data to a signature.\n\n## ❤️ Donate\n\n### Patreon\n\n[![Support me on Patreon](https://img.shields.io/endpoint.svg?url=https%3A%2F%2Fshieldsio-patreon.vercel.app%2Fapi%3Fusername%3DEvrenselKisilik%26type%3Dpatrons\u0026style=for-the-badge)](https://patreon.com/EvrenselKisilik)\n\n### Cryptocurrencies\n\n| Currency | Address                                    |\n| -------- | ------------------------------------------ |\n| BTC      | bc1qhvlc762kwuzeawedl9a8z0duhs8449nwwc35e2 |\n| ETH      | 0x1D99B2a2D85C34d478dD8519792e82B18f861974 |\n| USDT     | 0x1D99B2a2D85C34d478dD8519792e82B18f861974 |\n| USDC     | 0x1D99B2a2D85C34d478dD8519792e82B18f861974 |\n| XMR      | 426nQLFDwpZS64vy6DYdKaHwog3GofyPHFpxvmF6qSQuNg5XJCehv5zPpfh4ff9n5WWfTdKN1Jr29E1XSRuLkjQVJREF7jb |\n\n## License\n\nCopyright (C) 2023, Oğuzhan Eroğlu \u003crohanrhu2@gmail.com\u003e (https://oguzhaneroglu.com/)\n\nThis work is licensed under the terms of the MIT license.  \nFor a copy, see \u003chttps://opensource.org/licenses/MIT\u003e.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frohanrhu%2Fcatcrypt","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frohanrhu%2Fcatcrypt","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frohanrhu%2Fcatcrypt/lists"}