Jump to content




RandString - a random string generator API


5 replies to this topic

#1 ry00000

  • Members
  • 244 posts
  • LocationComputer, Base, SwitchCraft, Cube-earth, Blockiverse, Computer

Posted 08 July 2016 - 02:28 PM

Here I am. Presenting my 1st actually useful program to the CC Community:
RandString!
An API for random string generation
(i know the title isn't very creative)
Features:
1) Fully customizeable! Uses ASCII so if you have an ASCII lookup table handy you can find the variables and change them to generate random characters!
2) ASCII powered! This program uses string.char() so that you can modify the generated string however you want!


So what are you waiting for?

pastebin get 2F0XGYCQ randstring to download this program!

Huuuuuge thanks to MudkipTheEpic for providing the generation routine!

Spoiler

Edited by ry00000, 09 July 2016 - 11:51 AM.


#2 ReBraLaCC

  • Members
  • 100 posts
  • LocationSublime Text 2

Posted 08 July 2016 - 03:05 PM

Question, what will this be usefull for? because if you're using it for password encryption you need to save the password itself aswell, maybe usefull for a keycard but other idk :) nice code

#3 Cloud Ninja

  • Members
  • 361 posts

Posted 08 July 2016 - 03:12 PM

View PostReBraLaCC, on 08 July 2016 - 03:05 PM, said:

Question, what will this be usefull for? because if you're using it for password encryption you need to save the password itself aswell, maybe usefull for a keycard but other idk :) nice code
You could do Key = randstring() file = fs.open("/file","w") file.write(key.." user") file.close() and now you have a key for that user, and if they enter it, itll work. Tada!

#4 Lemmmy

  • Members
  • 218 posts

Posted 08 July 2016 - 03:22 PM

stringtable[math.random(#stringtable)] is not secure random. Do not use it for encryption, passwords or the likes. Here is a program which can generate cryptographically secure random numbers - it is an API therefore you could interface it with RandString by using stringtable[csrng.random(1, #stringtable)] instead, or write your own implementation of a cryptographically secure random number generator algorithm.

View PostElvishJerricco, on 26 May 2013 - 10:07 AM, said:

To be secure, the generator cannot be predictable. With linear random number generators (the fast ones like math.random in lua) you can see the previous value and determine what the next one will be. With this algorithm, and with all cryptographically secure generators, even if you've seen all the numbers emitted so far, you cannot predict the next number. You have to know the seed, which is usually a well kept secret from hackers.

Edited by Lemmmy, 08 July 2016 - 03:24 PM.


#5 ry00000

  • Members
  • 244 posts
  • LocationComputer, Base, SwitchCraft, Cube-earth, Blockiverse, Computer

Posted 09 July 2016 - 11:51 AM

This has absolutely NO intention to be cryptographically secure.

Edited by ry00000, 09 July 2016 - 03:48 PM.


#6 Anavrins

  • Members
  • 775 posts

Posted 09 July 2016 - 03:03 PM

Before you edited it, your post said that it could be used for encryption key, etc...
Not anymore I guess.





1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users