STW Clever types – random code generator – anyone??

Viewing 17 posts - 1 through 17 (of 17 total)
  • STW Clever types – random code generator – anyone??
  • Does any of you guys know of a system/app/program that could randomly generate a code that could then be cross referenced back to an ‘original’ code?


    true code

    random code generated would then when searched by us would reveal the original true code??

    Hope this makes sense

    Is this for you or your brother in-law?

    Premier Icon Drac

    Paging Chewkw.

    Premier Icon Daffy

    You could do this in Python in <30 mins.

    Tabulate your original codes in Excel and save as a CSV, Start Python, Import Numpy read the CSV into Python as an array, write a statement which reads the array and when a value without a corresponding value (next column) is found, it triggers the random number generator within a range of values and assigns those values to the array. Write the file back.

    Premier Icon sam_underhill

    If it doesn’t need to be in the same format you could just use a GUID generator and store that alongside your real data.

    Premier Icon Cougar

    Does it need to be secure? Ie, do you want it so only you can reverse it to get the original?

    If so you’ve basically just described encryption.



    You’re welcome

    Substitution. You have missed the random requirement.


    I think it depends on how the recovery of the original code would need to work.

    I think there are two approaches:

    1. Original code and random code are somehow cross-referenced in a database or similar. If this is acceptable, any pseudorandom number generator would do, so long as you ensure you avoid clashes in the database.

    2. Original code is algorithmically derived from the random code. You could do that with some kind of reversible/symmetric function. It could be a crypo function as Cougar says.

    If you want the mapping of original code to random code to be secure to some degree, you will need to consider this carefully in your approach.

    Premier Icon Cougar

    Actually, I’m slipping in my old age.

    You’be provided us with a solution and asked about how to implement it. This rather begs the question, what problem is this solution intended to solve?

    Premier Icon slackalice

    Actually, I’m slipping in my old age.

    You can get pads for that. With or without wings.


    Could VB Excel do this? Generates random set of characters generated and vlookup or search or similar to find the true code?

    You want two-way encryption using a cypher key of your choice.

    Premier Icon rjmccann101

    Without knowing about you particular use case, what are these codes used for, it’s hard to give a definitive answer. You could look at one way hashing, the openssl library is available on most platforms and provides sha3 secure one way hashes.

    If a raw hash is too much data you could use an agreed subset of the hash, say you want a 6 character code take characters 1,2,3,5,8,13 say each time. This does increase the risk of collision, two values giving the same code.

    The advantage of this approach is that you don’t have to store the codes, they can always be regenerated.

    But a lot of this depends on volumes and what your planning to actually do!

    Premier Icon molgrips

    Also, what platform are you working with?

    The OP said random code, so if that’s what he meant then it’s not derived from the original code. It’d have to be cross-referenced in a DB.


    Requirement sounds more like a tokenisation requirement than encryption.

Viewing 17 posts - 1 through 17 (of 17 total)

You must be logged in to reply to this topic.