I have a function that generates a random 16 character length (upper + lower case letters plus numbers) seed password:
const crypto = require('crypto');
function generateRandomString() {
const charset = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";
const length = 16;
const randomBytes = crypto.randomBytes(length);
let randomString = '';
for (let i = 0; i < length; i++) {
const randomIndex = randomBytes[i] % charset.length;
randomString += charset.charAt(randomIndex);
}
return randomString;
}
// Example usage:
const randomString = generateRandomString();
console.log(randomString);
This random string is then used as a seed to generate an ECDSA key pair.
What worries me is that the range of seed (62^16) approx is 4.7 *10^28 which is considerably less than the 256bit input needed to securely generate an ECDSA key according to my reading.
Whilst I can use an algo to increase the size of the seed input to the required 256bit input needed to generate the ECDSA key, wouldn't the reduced possibility space of the input hinder the safety of the key pair?