Hi:
This is related to programming, and I want to apply hash on my PDF filenaming, I create a function prototype something like this:
'this is one file named PDFHash.asa
<!--METADATA TYPE="TypeLib" UUID="{B72DF063-28A4-11D3-BF19-009027438003}"-->
<%
function PDFHash(filename, salt, stype)
dim cryptoManager, cryptoContext, cryptoHash
set cryptoManager = server.createobject("Persits.CryptoManager")
set cryptoContext = cryptoManager.openContext("mycontainer", true)
set cryptoHash = cryptoContext.createHash(algorithm)
cryptoHash.addText(salt & filename)
filename = cryptoHash.value
case select stype
case "MD5"
algorithm = calgMD5
case else
response.write "no algorithm"
end select
end function
%>
'note: salt is declared as constant in one file called constant.asa:
const salt = "ballpen"
'another file calling this function, i just copy the line that relates above
dim filename, cryptoSalt
filename = trim(prtLastName) & "_" & left(trim(prtFirstName), 1) & "_" & prtID
filename = PDFHash(filename, cryptoSalt, "MD5")
filename = trim(prtLastName) & "_" & filename & ".pdf"
now, upon executing the page, it says:
Microsoft VBScript compilation error '800a03f2'
Expected identifier
/Includes/PDFFilenameHash.asa, line 6
function PDFHash(filename, salt, type)
---------------------------------^
argument stype will be a string, which do a switch statement on to determine the algorithm. only "MD5" is supported and evaluates to 32771.
Please correct my code. Thanks.
Helen Costas