Creating 6-digit random number and calling bcrypt to return encryption

I need to generate a random 6-digit install key and store the hash of it using bcrypt on our database. Can someone point me in the right direction please.


Thanks for writing in. I'm not entirely sure of all of the requirements you'll need to meet, but I would start with these resources!

Thanks @jSims. Basically the use case is for issuing a license which will have an id (sql random 6 digit number) and also a license key which will stored on the Db as a hash. So on event trigger 'creatNewLicense' I want to call a js query which will generate the 6 digit random number and then bcrypt it to a hash with 10 rounds and return the hash for inclusion in the insert statement. Does that make sense? I have almost zero knowledge of JavaScript and don't know if retool would support that kind of query. Let me know if you think it's possible. Thanks.