ROCCA cipher implementation for Rust.

Overview

ROCCA for Rust

This is a Rust implementation of the ROCCA authenticated cipher, ported from the Zig implementation.

ROCCA is key committing, has a 256 bit key size, a 128 bit nonce, processes 256 bit message blocks and outputs a 128 bit authentication tag.

Cargo flags

  • std: allow dynamic allocations

std is the default.

IMPORTANT: In order to get decent code on x86 and x86_64 CPUs, you should set additional rustc flags prior to compiling that crate or a project using it:

export RUSTFLAGS="-Ctarget-feature=+aes,+sse4.1"

A benchmark can be run that way:

export RUSTFLAGS="-C target-cpu=native -Ctarget-feature=+aes,+pclmul,+sse4.1"
cargo bench

Benchmarks

Benchmarks take a 16384 bytes input block. Results are in bytes per second.

Rust implementations

Crates:

  • aes-gcm
  • chacha20poly1305
  • aegis128l
  • rocca

Macbook Pro - 2,4 GHz Intel Core i9, RUSTFLAGS set.

cipher speed
aes256-gcm 1.59 G/s
aes128-gcm 1.91 G/s
chacha20-poly1305 1.48 G/s
aegis128l 6.21 G/s
rocca 6.49 G/s

WebAssembly (Wasmtime)

cipher speed
aes256-gcm 36.88 M/s
aes128-gcm 44.13 M/s
chacha20-poly1305 193.05 M/s
aegis128l 48.98 M/s
rocca 58.61 M/s

Other implementations

cipher (implementation) speed
aes256-gcm (OpenSSL) 4.97 G/s
aes128-gcm (OpenSSL) 6.89 G/s
chacha20-poly1305 (OpenSSL) 2.67 G/s
aes128-ocb (OpenSSL) 7.10 G/s
aegis128l (Zig) 14.08 G/s
rocca (Zig) 16.28 G/s
You might also like...
Authorization Server with Rust using Tonic

authorization-server Authorization Server with Rust using Tonic. Function implemented User registration and profile store Change password Login Token

Extensible, strongly-typed Rust OAuth2 client library

OAuth2 An extensible, strongly-typed implementation of OAuth2 (RFC 6749). Documentation is available on docs.rs. Release notes are available on GitHub

An auth system/library for Rust applications

Rust : Forbidden (WIP) An experimental auth library for Rust applications. Goals This crate is to define a common set of traits and idioms to provide

Authenticate to Minecraft using the Microsoft Authentication Scheme from Rust.

Authenticating to Minecraft with the Microsoft Authentication Scheme from Rust This program showcases an implementation of the microsoft authenticatio

Rust library for HTTP authentication. Parses challenge lists, responds to Basic and Digest challenges. Likely to be extended with server support and additional auth schemes.

Rust library for HTTP authentication. Parses challenge lists, responds to Basic and Digest challenges. Likely to be extended with server support and a

Fast, simple and REST compliant file-server with public/private key authentication written in Rust

stormi Stormi is a fast and simple file-server with public/private key authentication How does it work? Stormi accepts multipart/form-data form with m

🔥 Firebase authentication for Rust 🦀
🔥 Firebase authentication for Rust 🦀

Fire Auth Rust wrapper for Firebase Authentication REST API Installation Add the following to Cargo.toml: fireauth = "0.1.5" How to use First you need

Tools for manipulating JSON Web Tokens, JWS, JWE, and JWK in Rust
Tools for manipulating JSON Web Tokens, JWS, JWE, and JWK in Rust

Rusty JWT Tools A collection of JWT utilities. This repository is part of the source code of Wire. You can find more information at wire.com or by con

Xbox live authentication flow for Minecraft with Rust.

MC Auth Xbox live authentication flow for Minecraft in Rust. Why? In order to create tools for Minecraft based on rust that implement the user profile

Comments
  • Very small or non-blocksize-multiple input size may not be decrypting properly

    Very small or non-blocksize-multiple input size may not be decrypting properly

    I can have some self-contained test cases on this in the coming days to showcase this, although speaking at a high level, I noticed that with this (Rocca) code (but not the similarly designed Morus one), small-sized (< 16 byte) inputs and/or inputs not a multiple of the blocksize, the decryption of an encrypted plaintext didn't return the original. For larger inputs or full integer multiple sizes I believe it was all working correctly. I thought this would be easy to reproduce with some test inputs at those sizes, but if not, please let me know. Note that the very similarly styled implementation for Morus didn't have an issue. Because these have similar design, looking at differences between them may help uncover what's going on. I'm using the encrypt/decrypt in-place mode.

    opened by Intensity 3
  • Consider implementing untagged decryption mode for select use cases

    Consider implementing untagged decryption mode for select use cases

    Although Rocca is an authenticated encryption mode producing and consuming a tag, it's possible that the user may deliberately not want to validate with a tag in some cases (they may not have it, or they may be achieving integrity checking in another way). I may point to a kind of "daisy chained" series of AEAD operations, or a length-preserving all-or-nothing-transform as examples.

    And so this is a suggestion to consider a variant in this (and related/Morus) code to not validate against a tag when the user deliberately wants to do that.

    A related idea is to have the decrypt produce the tag that the in-place encryption would have produced, and to return it instead of consuming it.

    opened by Intensity 1
Owner
Frank Denis
Parisian fashion photographer with a knack for cryptography, computer vision, opensource software and infosec. Get my public keys here: https://sk.tl/7CPRo8kn
Frank Denis
OpenSK is an open-source implementation for security keys written in Rust that supports both FIDO U2F and FIDO2 standards.

OpenSK This repository contains a Rust implementation of a FIDO2 authenticator. We developed this as a Tock OS application and it has been successfull

Google 2.4k Jan 2, 2023
RSA implementation in pure Rust

RSA A portable RSA implementation in pure Rust. ⚠️ WARNING: This crate has been audited by a 3rd party, but a full blog post with the results and the

Rust Crypto 346 Jan 4, 2023
SD-JWT Rust Reference Implementation

SD-JWT Rust Reference Implementation This is the reference implementation of the IETF SD-JWT specification written in Rust. Supported version: 6. Note

OpenWallet Foundation Labs 4 Dec 19, 2023
An oauth2 client implementation providing the Device, Installed and Service Account flows.

yup-oauth2 is a utility library which implements several OAuth 2.0 flows. It's mainly used by google-apis-rs, to authenticate against Google services.

Lewin Bormann 174 Dec 30, 2022
An implementation for an authentication API for Rocket applications.

rocket_auth rocket_auth provides a ready-to-use backend agnostic API for authentication management. For more information visit the documentation at ht

null 62 Dec 19, 2022
An implementation of webauthn components for Rustlang servers

Webauthn-rs Webauthn is a modern approach to hardware based authentication, consisting of a user with an authenticator device, a browser or client tha

Kanidm 232 Jan 8, 2023
A minimal jwt implementation for OIDC

Compact JWT Json Web Tokens (JWT) are a popular method for creating signed transparent tokens that can be verified by clients and servers. They are en

Kanidm 4 Dec 29, 2021
WebCipher - JWT encryption/decryption algorithms + a JWK Store implementation

webcipher provides JWT authentication utilities and storage mechanism for caching keys and optimizing decryption/encryption processes.

Wavy 1 May 1, 2022
JWT lib in rust

jsonwebtoken API documentation on docs.rs See JSON Web Tokens for more information on what JSON Web Tokens are. Installation Add the following to Carg

Vincent Prouillet 1.1k Jan 3, 2023
Example application using a Vue frontend with Rust backend that has authentication + authorization.

This project contains a Rust server that serves a single page application and has authentication + JWT-based authorization.

null 43 Dec 9, 2022