strRandomness

Score events according to their randomness based on the Shannon entropy of the string value of the specified column. Higher scores are given to more random strings. If a string contains no duplicate characters, it gets the highest score. Strings with duplicate characters get lower scores.

Usage Details

select *, strRandomness(column) as hashCode from tableName

-- column: column name to compute randomness score
-- tableName: name of a table

-- returnValue: randomnes (Shannon) of a string, if string contains no duplicate characters, it will get hightest score otherwise the more duplicate characters the string have less score it will get

Example

Input
table

id password
1axbyze@#fa23
2aaaaaa
select *, strRandomness(password) as passwordStrength from table

Output

id password passwordStrength
1axbyze@#fa236.0
2aaaaaa1.98

© 2017-2021 LogicHub®. All Rights Reserved.