npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

feistelled-reduced-aes-core

v0.0.1

Published

An implementation of a 3 rounds of Feistel around AES 2-transformation 1-subtitution step. Supposed to be a pseudorandom permutation.

Downloads

4

Readme

Feistelled Reduced AES Core

This is an implementation of a 3 rounds of Feistel Network around an AES 2-transformation step finishing with an AES substitution step. For every AES-step we use the next of the pre-generated AES-Keys.

Background

Request Based Authentication using a valid 256bit token. Using a randomly generated 256bit token for a session is usually fine.

But we want to also satisfy the next level risk which is a timely leaked token.

Therefore we constructed an "adequate" pseudorandom permutation. The pseudorandom permutation is based on a commonly known seed. For this we need:

  • infeasibility on recovering the seed
  • infeasibility to correctly guess the next

At the same time we want to be much faster than a hash-function like sha256. From which we know we can get this properties as well, when applied correctly.

For this reason we took the AES Core as a basis, where we know that in the full implementation these conditions are met. Then reduced it to a minimal version which should satisfy these conditions when being feistelled 3 times over.

Note: If we want the next level - which also includes message integrity checks- then we use SHA256-HMACs.

:warning:

There is no proof (yet) for any of these security properties we imply.

If you have an idea on how to analyse this implementation for these security properties - don't hesitate to throw a message! :-)

Usage

import { FRAESC } from "feistelled-reduced-aes-core"

seedBytes = # ... a shared seed

fraesc = new FRAESC(seedBytes)

console.log(freasc.generate())

counter = 0
console.log(freasc.generate(counter++))
console.log(freasc.generate(counter++))
console.log(freasc.generate(Date.now()))

console.log(freasc.generate())

Construct a new FRAESC instance with your seed as bytes (Uint8 Array of length 64).

The fraesc.generate() function generates the pseudorandom bytes (Uint8 Array of length 32).

  • Notice: fraesc.generate() returns always the same preallocated Uint8 Array and overwrites the previous one when generating the new pseudorandom bytes.
  • Notice: that the FRAESC is stateful. As every generation alters the internal left/right vectors.
  • Notice: You may provide additional entropy by passing a number value to the fraesc.generate(num) function.

License

All the sophisticated AES primitives are directly based ricmoos' aes-js Everything else consider as simply unlicensed ;-)

Unlicense JhonnyJason style