Hi everyone,
I have just spent a few hours trying to solve this and for the life of me I cannot. In my main stack I have a function called "UMP_HEXDigest"
it converts 20 bit sha1digest values to a normal string.
It works fine on its own.
But to when I try to envoke the function from elsewhere using the VALUE command, it just don't play nice. Its not allowing me to use a variablename as a parameter for the function. When it works, it returns the LITERAL value of the variable name and not the content of the variable. I've played with the syntax and I can't seem to get it.
Seems to me that is a limitation of the VALUE command.
PS ... I am taking "it" from ask password, putting it into a variable and then trying to hash it using the function.
Is there a workaround for this?
using the "value" command and passing variables
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller
using the "value" command and passing variables
Founder & Developer @ MakeShyft R.D.A - https://www.makeshyft.com
Build Software with AppStarterStack for Livecode - https://www.AppStarterStack.com
Save Time with The Time Saver's Toolbox - https://www.TimeSaversToolbox.com
Build Software with AppStarterStack for Livecode - https://www.AppStarterStack.com
Save Time with The Time Saver's Toolbox - https://www.TimeSaversToolbox.com
-
- VIP Livecode Opensource Backer
- Posts: 10052
- Joined: Sat Apr 08, 2006 7:05 am
- Contact:
Re: using the "value" command and passing variables
The "value" function is a tricky beast, similar to JavaScript's "eval" in that it attempts to evaluate the expression passed into it. Since the data returned from sha1Digest is binary, it may just be that "value" is tripping up trying to figure out how it's a LiveCode expression.
For hash output as hex, try the binaryDecode function:
For hash output as hex, try the binaryDecode function:
Code: Select all
function CleanHash pString
local tHex
get binaryDecode("h*", sha1digest(pString), tHex)
return tHex
end CleanHash
Richard Gaskin
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn
Re: using the "value" command and passing variables
ahhh shikes..... that makes perfect sense.....why convert it if I can just output the proper string to begin with.
Richard.... I can't tell you how much I appreciate all the times you have helped me already and its only been 2 months since I've been here. You are building up some good karma my friend.
Richard.... I can't tell you how much I appreciate all the times you have helped me already and its only been 2 months since I've been here. You are building up some good karma my friend.
Founder & Developer @ MakeShyft R.D.A - https://www.makeshyft.com
Build Software with AppStarterStack for Livecode - https://www.AppStarterStack.com
Save Time with The Time Saver's Toolbox - https://www.TimeSaversToolbox.com
Build Software with AppStarterStack for Livecode - https://www.AppStarterStack.com
Save Time with The Time Saver's Toolbox - https://www.TimeSaversToolbox.com
-
- VIP Livecode Opensource Backer
- Posts: 10052
- Joined: Sat Apr 08, 2006 7:05 am
- Contact:
Re: using the "value" command and passing variables
I'm just paying it forward, Tom. All these years I've been the lucky recipient of many people's patient assistance. Passing some of that along is the least I can do.
Richard Gaskin
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn