Skip to main content

Hash value

Are there any function in IDEA or that can be called with a script to calculate a hash value of a string?

klmi Fri, 04/16/2021 - 10:21

Step 1: Create a file "sha256.py" in your folder of user defined functions and copy that code into the file:

import hashlib
def sha256(s1):
return hashlib.sha256(s1.encode()).hexdigest()

Step 2: Create a new field in your IDEA database and use as equation:

@Python("sha256";FIELD_TO_HASH)

FIELD_TO_HASH is the name of the field for which you want to calucate the hash.

* IDEA 10.3 or higher necessary for integrated Python support
** "Run Python-Scripts" must be checked in preferences