{"id":13339858,"url":"https://github.com/tuokri/UnrealScript-FCrypto","last_synced_at":"2025-03-11T15:31:36.412Z","repository":{"id":189368741,"uuid":"628735912","full_name":"tuokri/UnrealScript-FCrypto","owner":"tuokri","description":"Pure UnrealScript SSL/TLS implementation and cryptography utilities based on BearSSL. Work in progress.","archived":false,"fork":false,"pushed_at":"2025-01-20T14:16:32.000Z","size":407,"stargazers_count":1,"open_issues_count":4,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-02-01T15:45:54.725Z","etag":null,"topics":["bearssl","block-cipher","cryptography","decryption","ecdh","ecdhe","encryption","hkdf","hmac","https-client","sha-1","udk","ue3","unreal-engine-3","unrealscript","xxtea"],"latest_commit_sha":null,"homepage":"","language":"UnrealScript","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/tuokri.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE-BearSSL.txt","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":"2023-04-16T21:13:33.000Z","updated_at":"2025-01-08T08:04:50.000Z","dependencies_parsed_at":"2024-06-28T22:27:03.824Z","dependency_job_id":"0abb60e7-0139-4e83-a092-826f744e55db","html_url":"https://github.com/tuokri/UnrealScript-FCrypto","commit_stats":null,"previous_names":["tuokri/unrealscript-fcrypto"],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tuokri%2FUnrealScript-FCrypto","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tuokri%2FUnrealScript-FCrypto/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tuokri%2FUnrealScript-FCrypto/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tuokri%2FUnrealScript-FCrypto/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/tuokri","download_url":"https://codeload.github.com/tuokri/UnrealScript-FCrypto/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243059635,"owners_count":20229611,"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":["bearssl","block-cipher","cryptography","decryption","ecdh","ecdhe","encryption","hkdf","hmac","https-client","sha-1","udk","ue3","unreal-engine-3","unrealscript","xxtea"],"created_at":"2024-07-29T19:21:19.426Z","updated_at":"2025-03-11T15:31:36.056Z","avatar_url":"https://github.com/tuokri.png","language":"UnrealScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# FCrypto\n\nUnrealScript cryptography utilities. The majority of this library\nis based heavily on [BearSSL](https://www.bearssl.org/).\n\n# DISCLAIMER: This library is under development and should be considered pre-alpha software!\n\n#### Why BearSSL?\n\nFCrypto is based on BearSSL simply because it is one of the most well documented\ncryptography libraries I have studied. The code is extremely readable and has\nhelpful comments for both the API and the internals. The design choices and\nimplementation details with their rationale are extensively documented --\nin and out of code. As UnrealScript is a C-like language (although not nearly\nas low level as C), it is quite natural to port C code to UScript.\nHowever, the number one reason for using BearSSL as a basis for my own UnrealScript\nimplementation was its i15 big integer implementation. It was the only big integer\nreference implementation I could find that doesn't use any integer data types\nwider than 32 bits. Since Unrealscript only has bytes and 32 bit (signed)\ninteger types, BearSSL's i15 implementation was perfect for\nthis use case. It is also possible there are other big integer implementations\nthat could have been easier to port into UnrealScript, and I just hadn't looked\nhard enough. But in any case, BearSSL is the perfect learning tool from a\ncryptography novice's perspective.\n\n#### How secure is it?\n\nUsing FCrypto for any real production applications that transfer actual\ncritical/confidential data is not recommended. Any constant-time cryptography\nguarantees of BearSSL could be lost in the porting process from C to\nUnrealScript (not to mention bugs). FCrypto does not implement the entire\nTLS suite. UnrealScript scripting engine is also a proprietary black box, so\nit is hard to make any low level guarantees on what the script code actually does.\nWith that said, FCrypto is still probably more than secure (actually, probably\noverkill) for all the video game server data transfer purposes of my personal\nprojects.\n\nTODO: List other references/influences.\n\nThe \"F\" in FCrypto stands for my online username \"fluudah\" (yeah, lazy naming).\n\n## Example Use Case\n\nTODO: move/rename this section\n\n1. ECDHE to exchange per-session keys (used for XXTEA).\n2. ECDH to exchange static keys (used for HMAC).\n3. Communicate application data.\n\n## Features\n\n### Big (Modular) Integers\n\nUnrealScript big integer implementation based on\n[BearSSL \"i15\" implementation](https://bearssl.org/bigint.html).\n\nThere are quite a many restrictions and details related to the\nimplementation, so reading BearSSL documentation on big integer\ndesign is necessary if you plan on using this feature.\n\n#### Implementation Notes\n\nUnrealScript only has 32-bit integers, whereas BearSSL i15 big integers use\n`uint16_t*` as the underlying type. This UScript implementation is therefore\nessentially wasting half of the memory space. This should however be negligible\nfor any modern system running UE3 games or servers. For export, the integers\ncan be encoded into a byte array format that does not waste memory. Various\nplaces in the code have additional checks to ensure the results are not altered,\nnotably when writing UScript 32-bit integers into (originally) 16-bit variables\nin the BearSSL version e.g.:\n\n```UnrealScript\nX[V++] = Acc \u0026 0xFFFF; // @ALIGN-32-16.\n```\n\n### Key Exchange\n\n#### ECDH\n\nElliptic Curve Diffie-Hellman.\n\n#### ECDHE\n\nElliptic Curve Diffie-Hellman Ephemeral.\n\n#### Supported Elliptic Curves\n\n##### Curve25519\n\n### Symmetric Encryption\n\n#### XXTEA\n\nXXTEA with PKCS #7. Included in the library due to simplicity of the implementation.\nXXTEA is theoretically vulnerable, but used for being lightweight and secure enough\nfor non-critical data.\n\n### Hash Functions\n\n#### SHA-1\n\n### Other (TODO)\n\n#### HMAC\n\n#### HKDF\n\n#### Development TODOs\n\n##### Release tooling\n\nFor actual releases we'll want a versioned script package.\nWrite a release generation script that copies only the needed\nscript files into a versioned directory and compiles the release.\n\n1. Grab version tag from Git.\n2. Copy and rename files with the version appended.\n3. Final result should be something like FCrypto_0_1_0.u.\n\nThis allows us to release new versions without causing compatibility\nissues with older versions while also discarding development and testing\nonly files from the final release.\n\n##### Benchmarking suite\n\nBenchmark our current `const out` optimizations (assumed to be a reference)\nfor passing in arrays (dynamic \u0026 static) and structs into functions vs. just\ncopying them.\n\nInitial testing suggests `const out` does provide a minor speedup when testing\nwith large number of benchmark iterations. The plain copy version is faster when\ndoing very few iterations.\n\nWhen the amount of data is large e.g., a struct containing arrays, the `const out`\nversion clearly beats the copy version.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftuokri%2FUnrealScript-FCrypto","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftuokri%2FUnrealScript-FCrypto","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftuokri%2FUnrealScript-FCrypto/lists"}