0

MD5 help



Hi, i found an md5 function in the brightscript documentation, but it looks like it is not working any ideas?

9 comments

  • 0
    Avatar
    RokuLyndon


    I'm going to need more details than that.
  • 0
    Avatar
    bmn


    Well i needed to convert a string to an MD5 hash, and found this in the documentation:

    ifStringOps
    SetString(s As String, strlen As Integer) As Void
    AppendString(s As String, strlen As Integeter) As void
    Len() As Integer
    GetEntityEncode() As String
    Tokenize(delim as String) As Object
    Trim() As String
    MD5() As String

    and this

    Box(x as Dynamic) as Object
    Box() will return an object version of an intrinsic type, or pass through an object if given
    one.   For example, in places where you want to use string object functions on a string,
    you can:

    str=”   this is a string   ”
    print box(str).trim()
    bo = box(“string”)
    bo=box(bo)  „ no change to bo
    print bo.md5()

    showing a clear reference to a md5 function that i assume should return an md5 hash of the string

    am i corerct?

    thanks!
  • 0
    Avatar
    bmn


    i tried both:

    string.md5() and MD5(string), none seem to work..
  • 0
    Avatar
    RokuLyndon


    Are you talking about the Roku documentation? I don't see any of this in the BrightSign documentation.
  • 0
    Avatar
    bmn



    ive read about that here:

    http://www.brightsign.biz/documents/HDCompactBrightScriptReferenceManual.pdf

    either way, if theres no native md5 encoding support, any other solution??

    thanks!

  • 0
    Avatar
    RokuLyndon


    ok, so where's the actual code that you tried to use? What firmware are you running?
  • 0
    Avatar
    bmn


    im running software version 4.2 build 1006
  • 0
    Avatar
    bmn


    i tried the same example the documentation has... and its giving error..
  • 0
    Avatar
    bmn


    found by chance the solution:

       ba1 = CreateObject("roByteArray")
       ba2 = CreateObject("roByteArray")
       ba2.FromAsciiString(values)
       digest = CreateObject("roEVPDigest")
       digest.setup("md5")
       digest.Update(ba1)
       digest.Update(ba2)
       result = digest.Final()
       print result
Please sign in to leave a comment.