rawdog

master

raw binary representation protocol in swift. and some crypto too.
tannerdsilva/rawdog

rawdog

rawdog is a lean, dependency-free* Swift package created to simplify and expedite the binary encoding and decoding process for programming objects.

the primary utility of this library comes in its ability to express statically allocated memoryspace, while automatically handling alignment, endianness, and initialization to and from other types.

in c, the following syntax is common and efficient uint8_t[1024]. in swift, trying to achieve a similar result (unaligned memory allocations with static length) is a nightmare....tuple literals are radically more verbose and notably less flexable than the c equivalent in syntax. this is the swift-specific problem that rawdog solves and builds on, while maintaining a rational but powerful pattern around type strictness and memory safety that Swift syntax is known for.

Documentation

I'm really happy with the structure and clarity of the code itself but documentation coverage is incomplete.

Crypto

rawdog distributes and builds its own source material (in c) for all cryptographic functions, including:

  • blake2 hashing (keyed and unkeyed in all variants)
  • SHA1,256,512 hashing
  • MD5 hashing
  • ed25519 signature scheme
  • bcrypt blowfish password hashing
  • chachapoly AEAD

these sources come with a complete suite of tests that tested to pass on x86 and ARM, macOS and Linux. the code is also expected to handle endianness natively, although admittedly I do not have the means of verifying the

Cryptographic Attributions

rawdog cryptography is built on various open source contributions written in c. these references were taken as offered from their original authors in either MIT or public domain licenses, and redistributed in this rawdog package with its MIT license.

  • cryptographic sources modified and redistributed in June 2024

    • blake2 hashing - claimed from public domain with test vectors referenced in Swift XCTest. Thank you Jean-Philippe Aumasson, Samuel Neves, Zooko Wilcox-O’Hearn, Christian Winnerlein.

    • ed25519 - claimed from public domain with unit tests maintained in modification. Thank you Andrew M.

    • crypt_blowfish - claimed from public domain with unit tests mainted in modification. Thank you Solar Designer.

    • chachapoly - claimed with MIT license with unit test maintained in modification. Thank you Grigori Goronzy.

    • SHA (implementations 1, 256, 512) & MD5 hashing - claimed from public domain with unit test maintained in modification. Thank you WaterJuice.

Inspiration

The fundamental components of the RAW module draw their inspiration from the LMDB and its MDB_val structure. Over time, I found immense value in this structure and the protocols built around it, initially developed in my QuickLMDB library, and implemented them in numerous Swift projects.

As I increasingly incorporated this structure and its related protocols from QuickLMDB into my regular coding routines, I decided to create a separate library – rawdog and its RAW module – by forking QuickLMDB and its data handling protocols. This decision aimed to help projects standardize, secure, and simplify data transfer methods, fostering an environment that equally accommodates Swift and C programming languages.

Versioning

This project follows the tagging semantics outlined in SemVer 2.0.0.

Requirements

Given the critical use of macros in this suite, rawdog requires Swift language v5.9.0 or above to build and deploy successfully.

License

rawdog and the entirety of its source is offered without warranty or support under the MIT license.

Description

  • Swift Tools 5.9.0
View More Packages from this Author

Dependencies

Last updated: Mon Nov 18 2024 21:55:58 GMT-1000 (Hawaii-Aleutian Standard Time)