Support

If you have a problem or need to report a bug please email : support@dsprobotics.com

There are 3 sections to this support area:

DOWNLOADS: access to product manuals, support files and drivers

HELP & INFORMATION: tutorials and example files for learning or finding pre-made modules for your projects

USER FORUMS: meet with other users and exchange ideas, you can also get help and assistance here

NEW REGISTRATIONS - please contact us if you wish to register on the forum

Users are reminded of the forum rules they sign up to which prohibits any activity that violates any laws including posting material covered by copyright

random keygen

For general discussion related FlowStone

random keygen

Postby Nubeat7 » Fri Aug 30, 2013 10:31 pm

after some research i found this code:
Code: Select all
(0..@lenght).to_a.map{|a| rand(16).to_s(16)}.join

to generate random keys like are used for serial or product keys...
i simply run a loop and save it in an array, like this my computer is able to generate up to 30 000 keys (ruby module turns off with 50 000...

it would be useful to provide a list of pruduct keys for purchasing custumors of your software product(to get updates with the key) or maybe also for a simple protection system...

my question now is, are the generated numbers unique in this code?

how to bulid a guid / uuid keygen? found some codes about "SecureRandom" can this be used in FS?

some link about: http://stackoverflow.com/questions/1117 ... ds-in-ruby
Attachments
randomKeyGen.fsm
(14.14 KiB) Downloaded 855 times
User avatar
Nubeat7
 
Posts: 1347
Joined: Sat Apr 14, 2012 9:59 am
Location: Vienna

Re: random keygen

Postby Tronic » Sat Aug 31, 2013 1:35 am

if you do not have to use it to the plugins (because now they can no longer recall, external extensions)
it can be created using Win32API.
only with the ruby is not effectively secure and unique.

Code: Select all
require 'Win32API'
# http://msdn.microsoft.com/en-us/library/windows/desktop/aa379205(v=vs.85).aspx
@api = Win32API.new('rpcrt4', 'UuidCreate', 'P', 'L')

buffer = ' ' * 16
@api.call(buffer)

a, b, c, d, e, f, g, h = buffer.unpack('SSSSSSSS')
uuid = a, b, c, d, e, f, g, h  # => [33474, 814, 35932, 17755, 31113, 32122, 12955, 9560]
Tronic
 
Posts: 539
Joined: Wed Dec 21, 2011 12:59 pm

Re: random keygen

Postby Nubeat7 » Sun Sep 01, 2013 1:41 pm

thanks tronic, but looks like this one has just 5 digits and only numbers so i think its not very secure with 100 000 possibilities, i really dont get how this is working how should a 5 digit number be universal unique? here i also tried another library but with the same effect, or is every letter in your example one part of the uuid?

Code: Select all
    require 'Win32API'
    @api = Win32API.new('ole32', 'CoCreateGuid', 'P', 'S')
    buffer = ' ' * 16
    @api.call(buffer)
    uuid = buffer.unpack('SSSSSSSS')


if so how can i get it in a format with letters too like these classic serials like jK39-o7U2-287b-kjh5 with 0..9, A..Z, a..z included

like the example in my first post but i don`t know if keys are repeating with this code?
i mean when i use
Code: Select all
output p.uniq
instead of
Code: Select all
output p
all the generated key are unique, what doesnt mean that they are universal unique identifiers?
User avatar
Nubeat7
 
Posts: 1347
Joined: Sat Apr 14, 2012 9:59 am
Location: Vienna


Return to General

Who is online

Users browsing this forum: No registered users and 67 guests