Anyone has examples of UUID Sha1 creation process ?

Creating desktop or client-server database solutions?

Moderators: heatherlaine, Klaus, FourthWorld, robinmiller, kevinmiller

Post Reply
teriibi
Posts: 252
Joined: Mon Nov 13, 2017 3:49 pm
Location: Bolivia

Anyone has examples of UUID Sha1 creation process ?

Post by teriibi » Wed Feb 14, 2018 5:45 pm

Hi,
could not find much LC doc about this UUID function...

So far I can script this (but actualy I dont want a random result)
...anyone knows how to fill up params for a sha1 method ?

Code: Select all

Random results :   put uuid("random") into fld tResu
also random results : put uuid("sha1",uuid(),"api_secret")  into fld tResu
How can I make one that would use a string like name+fname to always produce the same results ?
tks :roll:

ghettocottage
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 250
Joined: Tue Apr 10, 2012 9:18 am

Re: Anyone has examples of UUID Sha1 creation process ?

Post by ghettocottage » Wed Feb 14, 2018 7:48 pm

Other more knowledgeable Livecoders will have to speak up to confirm this, but if you are looking for something where you can create the same results on demand given some input, then UUID might be counter-intuitive to that, since it creates a unique ID each time.

You could just write your own little function like:

Code: Select all

function reusableID
   put tName & tFullName into tNames
   put sha1Digest(tNames) into tResult
   return tResult
end reusableID
and then use it like:

Code: Select all

put reusableID("Bill","Bill Smith") into tData

teriibi
Posts: 252
Joined: Mon Nov 13, 2017 3:49 pm
Location: Bolivia

Re: Anyone has examples of UUID Sha1 creation process ?

Post by teriibi » Wed Feb 14, 2018 9:24 pm

oh, is that right, coz I had read in an article that in UUID version 3 and 5 - if im right- would allow you to use some defined parameters (as a name) and get a same (but unic) resulting string everytime...
that is what I m looking for. Vers 3 or 5. not the other UUID versions...who "would" work in another way.
Doesnt seem s/t that many arround here are using... :arrow:


PS: adding the ref. to article that says such...(dont know how worth it is.)
https://stackoverflow.com/questions/203 ... ion-to-use
Version 4: These are generated from random (or pseudo-random) numbers. If you just need to generate a UUID, this is probably what you want.

If you need to always generate the same UUID from a given name, you want a version 3 or version 5.
True.. :?: :?:

Addding another URl ref. that says the same - as far as I get it :oops: :
...but since its in Python...- I couldnt just "convert" it into LC.
(Maybe s/o here could do it :wink: )
..Plizzzzzzzzzzzz :mrgreen:
https://pymotw.com/2/uuid/
The UUID value for a given name in a namespace is always the same, no matter when or where it is calculated. Values for the same name in different namespaces are different.

Code: Select all

import uuid
-----------
for i in xrange(3):
    print uuid.uuid3(uuid.NAMESPACE_DNS, 'www.doughellmann.com')
$ python uuid_uuid3_repeat.py
----------------
bcd02e22-68f0-3046-a512-327cca9def8f
bcd02e22-68f0-3046-a512-327cca9def8f
bcd02e22-68f0-3046-a512-327cca9def8f

teriibi
Posts: 252
Joined: Mon Nov 13, 2017 3:49 pm
Location: Bolivia

Re: Anyone has examples of UUID Sha1 creation process ?

Post by teriibi » Thu Feb 15, 2018 7:12 pm

Tks Ghetto,

Yep thats a much more simple way to go to...dont know how unic it can be.
produces lots of Weird Chars :lol:

Code: Select all

   put sha1Digest(tNames) into tResult
In what format is that resulting string ?

ghettocottage
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 250
Joined: Tue Apr 10, 2012 9:18 am

Re: Anyone has examples of UUID Sha1 creation process ?

Post by ghettocottage » Thu Feb 15, 2018 8:22 pm

sha1...I think...

what is your goal? Are you just trying to come up with an encrypted identifier? Are you using this to send?

Post Reply

Return to “Databases”