GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — GitHub - opencoff/crypto-rand: AES and Chacha based cryptographic random generator

BranchesTags
Open more actions menu

Latest commit

 

History

1 Commit
1 Commit

Folders and files

NameName
Last commit message
Last commit date
.gitignore
.gitignore
 
 
Makefile
Makefile
 
 
README.md
README.md
 
 
aes.c
aes.c
 
 
aes.h
aes.h
 
 
chacha_private.h
chacha_private.h
 
 
cipher.h
cipher.h
 
 
cputime.h
cputime.h
 
 
cryptorand.c
cryptorand.c
 
 
cryptorand.h
cryptorand.h
 
 
error.c
error.c
 
 
posix_entropy.c
posix_entropy.c
 
 
t_aesrand.c
t_aesrand.c
 
 
t_aesrand_bench.c
t_aesrand_bench.c
 
 
t_arc4rand.c
t_arc4rand.c
 
 
t_arc4rand_bench.c
t_arc4rand_bench.c
 
 

Repository files navigation

crypto-rand

This is a thread-safe adaptation of OpenBSD arc4random(2) cryptographic random generator but generalized to use AES-256-CTR or Chacha20 ciphers.

Both cryptographic random generators pass NIST-SP800-22 (Rev 1a).

Using the API

The core of the code is in cryptorand.c and the API is documented in cryptorand.h.

Testing and Performance

The NIST-SP800-22 test suite is here.

To run the NIST-SP800-2 tests, first fetch the test-suite from github:

git clone https://github.com/dj-on-github/sp800_22_tests.git

make
./t_arc4rand 1048576 > arc4
./t_aesrand 1048576 > aes

cd sp800_22_tests
./sp800_22_tests.py ../arc4
./sp800_22_tests.py ../aes

There are also a couple of benchmarks to measure speed of the generators against the system's random generator (/dev/urandom):

    ./t_arc4rand_bench 16 32 64 128
    ./t_aesrand_bench  16 32 64 128

The benchmarks show the speed-up of the generators relative to the system's random generator.

The core random generator should be quite portable to any system (including RTOS). It only uses C stdlib and no stdio. The repository includes portable implementations of AES and Chacha20. The cipher specific code is separated into cipher.h. If your platform provides HW accelerated AES, it is quite easy to plug that into this generator.

How is it licensed?

I don't have any special licensing terms; my changes are subject to the original licensing terms in the file cryptorand.c.

About

AES and Chacha based cryptographic random generator

Topics

aes256-randomarc4randomchacha-ciphercryptographic-random-generatornist-sp-800-22

Resources

Readme
Activity

Stars

3 stars

Watchers

2 watching

Forks

0 forks
Report repository

Releases

Packages

Contributors

Languages

You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.