GithubHelp home page GithubHelp logo

tuokri / unrealscript-fcrypto Goto Github PK

View Code? Open in Web Editor NEW
0.0 2.0 0.0 167 KB

UnrealScript cryptography utilities.

License: MIT License

UnrealScript 94.06% Python 5.94%
cryptography decryption encryption unreal-engine-3 unrealscript bearssl block-cipher ecdh ecdhe hmac

unrealscript-fcrypto's Introduction

FCrypto

UnrealScript cryptography utilities. The majority of this library is based heavily on BearSSL.

DISCLAIMER: This library is under development and should be considered pre-alpha software!

Why BearSSL?

FCrypto is based on BearSSL simply because it is one of the most well documented cryptography libraries I have studied. The code is extremely readable and has helpful comments for both the API and the internals. The design choices and implementation details with their rationale are extensively documented -- in and out of code. As UnrealScript is a C-like language (although not nearly as low level as C), it is quite natural to port C code to UScript. However, the number one reason for using BearSSL as a basis for my own UnrealScript implementation was its i15 big integer implementation. It was the only big integer reference implementation I could find that doesn't use any integer data types wider than 32 bits. Since Unrealscript only has bytes and 32 bit (signed) integer types, BearSSL's i15 implementation was perfect for this use case. It is also possible there are other big integer implementations that could have been easier to port into UnrealScript, and I just hadn't looked hard enough. But in any case, BearSSL is the perfect learning tool from a cryptography novice's perspective.

How secure is it?

Using FCrypto for any real production applications that transfer actual critical/confidential data is not recommended. Any constant-time cryptography guarantees of BearSSL could be lost in the porting process from C to UnrealScript (not to mention bugs). FCrypto does not implement the entire TLS suite. UnrealScript scripting engine is also a proprietary black box, so it is hard to make any low level guarantees on what the script code actually does. With that said, FCrypto is still probably more than secure (actually, probably overkill) for all the video game server data transfer purposes of my personal projects.

TODO: List other references/influences.

The "F" in FCrypto stands for my online username "fluudah" (yeah, lazy naming).

Example Use Case

TODO: move/rename this section

  1. ECDHE to exchange per-session keys (used for XXTEA).
  2. ECDH to exchange static keys (used for HMAC).
  3. Communicate application data.

Features

Big (Modular) Integers

UnrealScript big integer implementation based on BearSSL "i15" implementation.

There are quite a many restrictions and details related to the implementation, so reading BearSSL documentation on big integer design is necessary if you plan on using this feature.

Implementation Notes

UnrealScript only has 32-bit integers, whereas BearSSL i15 big integers use uint16_t* as the underlying type. This UScript implementation is therefore essentially wasting half of the memory space. This should however be negligible for any modern system running UE3 games or servers. For export, the integers can be encoded into a byte array format that does not waste memory. Various places in the code have additional checks to ensure the results are not altered, notably when writing UScript 32-bit integers into (originally) 16-bit variables in the BearSSL version e.g.:

X[V++] = Acc & 0xFFFF; // @ALIGN-32-16.

Key Exchange

ECDH

Elliptic Curve Diffie-Hellman.

ECDHE

Elliptic Curve Diffie-Hellman Ephemeral.

Supported Elliptic Curves

Curve25519

Symmetric Encryption

XXTEA

XXTEA with PKCS #7. Included in the library due to simplicity of the implementation. XXTEA is theoretically vulnerable, but used for being lightweight and secure enough for non-critical data.

Hash Functions

SHA-1

Other (TODO)

HMAC

HKDF

unrealscript-fcrypto's People

Contributors

tuokri avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.