Comments (3)
For non-power of 2 length charsets look at https://github.com/puid/Elixir. That library is an extension of EntropyString to any custom character sets. An optimized version for the characters you listed is actually already provided.
Using the Puid library does, of course, require the caveats of calling Elixir code from Erlang. I used mix to create a quick Elixir project that had one file, upper_alpha_num.ex:
defmodule(UpperAlphaNum, do: use(Puid, bits: 96, charset: :alphanum_upper))
I ran an Erlang shell including the BEAM files from the compilation of that simple Elixir project, as well as the BEAM files for Elixir, and got:
1> 'Elixir.UpperAlphaNum':info().
#{'struct' => 'Elixir.Puid.Info',
chars => <<"ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789">>,
charset => alphanum_upper,entropy_bits => 98.23,
entropy_bits_per_char => 5.17,ere => 0.65,length => 19,
rand_bytes => fun crypto:strong_rand_bytes/1}
2> 'Elixir.UpperAlphaNum':generate().
<<"BHG00YLBEKLBAANM1AK">>
from erlang.
Thanks for your help but i've zero interest on Elixir and for sure i'll not ship BEAM code that way.
from erlang.
Are the characters really important? You could drop four of them and have a 32 length set. Using 96-bits of entropy (you didn't specify), the difference is:
36 characters:
entropy_bits: 98.23,
entropy_bits_per_char: 5.17,
ere: 0.65,
length: 19
32 characters:
entropy_bits: 100.0,
entropy_bits_per_char: 5.0,
ere: 0.63,
length: 20
from erlang.
Related Issues (1)
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from erlang.