Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

JS md5 password autogenerator #194

Closed
nickhilliard opened this issue Dec 11, 2014 · 1 comment
Closed

JS md5 password autogenerator #194

nickhilliard opened this issue Dec 11, 2014 · 1 comment

Comments

@nickhilliard
Copy link
Member

Do standard JS implementations have a good enough RNG to be able to create useful BGP MD5 passwords? (INEX ticket [QIG-18162-453])

@barryo
Copy link
Member

barryo commented Dec 12, 2014

The function is:

function randomString( length ) {
    var result = '';
    var chars = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ';
    for (var i = length; i > 0; --i) result += chars[Math.round(Math.random() * (chars.length - 1))];
    return result;
}

The built-in JavaScript Math.random() function is not a cryptographic-grade random number generator. That is not to say that I consider this implementation to be a security issue.

A solution is now available for most platforms: crypto.getRandomValues()

Using this, we can only allow random generation of the MD5 if that object is available.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants