String.hash() method missing

Activity

Show:

Pothys - MitrahSoft 27 May 2021 at 13:35

struct.hash() throws an error like Can't cast Complex Object Type Struct to String. The same problem explained here https://luceeserver.atlassian.net/browse/LDEV-3480?focusedCommentId=48725

Mircea Botez 5 May 2021 at 11:18

Michael Offner 3 May 2021 at 10:24

please take as an example the following

https://github.com/lucee/Lucee/blob/6.0/core/src/main/java/resource/fld/core-base.fld#L11891-11907

because the function hash is not specific for string (input type is object), you need to define a separate (hidden) function for hash that calls the original function but in contrast uses as input a string.

Adam Cameron 1 May 2021 at 18:50

Still appears to be missing, 4yrs later?

 

<cfscript> writeOutput(server.coldfusion.productVersion & "<br>") try { writeOutput("some string to hash".hash("sha-256")) } catch (any e){ writeOutput(e.message) } </cfscript>

CF2018:

 

2018,0,11,326016 EA83A45637A9AF470A994D2C9722273EF07D47AEC0660A1D10AFE6E9586801AC

Lucee 5

 

2016,0,03,300357 The function [hash] does not exist in the Object.

I wasn’t checking up on this, I just happened to write that code expecting it to work, and was about to raise a ticket when I noticed… I already had…

Fixed

Details

Assignee

Reporter

Labels

New Issue warning screen

Before you create a new Issue, please post to the mailing list first https://dev.lucee.org

Once the issue has been verified, one of the Lucee team will ask you to file an issue

Sprint

Fix versions

Affects versions

Priority

Created 2 May 2017 at 08:55
Updated 27 April 2022 at 16:55
Resolved 19 May 2021 at 11:44