Results 1 to 5 of 5
  1. #1

    Post Need help in Classic ASP programming


    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

  2. #2
    Elite Member
    Join Date
    Aug 2008
    Posts
    1,053
    Blog Entries
    1
    the error is Expected identifier not related to any hashing or encrypting.

    case select type ? are you sure on this?

  3. #3
    mistype, that should select case

    I found what makes an error, it is because type is a reserved word of VB, I have to change it something like this:

    stype or argumentType


    but when I execute it, it does not effect the hashing, do i miss lines of codes here?

    Quote Originally Posted by MarkCuering View Post
    the error is Expected identifier not related to any hashing or encrypting.

    case select type ? are you sure on this?

  4. #4
    Elite Member
    Join Date
    Aug 2008
    Posts
    1,053
    Blog Entries
    1
    what's the error now?

  5. #5
    The variable algorithm was used before it has been assigned a value.
    Code:
    ...
    set cryptoHash = cryptoContext.createHash(algorithm)
    ...
    case "MD5"
    algorithm = calgMD5
    ...

  6.    Advertisement

Similar Threads

 
  1. need help in java programming: creating a folder
    By rastaman81 in forum Programming
    Replies: 4
    Last Post: 03-11-2009, 08:51 AM
  2. C/C++ i need help in making a program
    By mE_bytes in forum Programming
    Replies: 54
    Last Post: 07-30-2008, 05:41 PM
  3. Need help in programming C#?
    By mrrob2001 in forum Programming
    Replies: 3
    Last Post: 06-05-2008, 08:52 PM
  4. Need help in Installing Java programs in my Samsung D880
    By Soj in forum Software & Games (Old)
    Replies: 0
    Last Post: 04-24-2008, 06:34 PM
  5. Want to buy a new mp3 player. Need help in selecting one.
    By metdumangas in forum Gizmos & Gadgets (Old)
    Replies: 21
    Last Post: 01-04-2006, 09:01 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
about us
We are the first Cebu Online Media.

iSTORYA.NET is Cebu's Biggest, Southern Philippines' Most Active, and the Philippines' Strongest Online Community!
follow us
#top