GP SoftwareTwitter
Opus FAQsManualCommandsObjects

Calculate SHA-1 of a String (for use in a script function)


What's a decent way to do this in a script (i.e. minimizing external dependencies)?

How to use FSUtil.Hash on a string (JScript)?

You could write the string to a temp file and then use FSUtil.Hash on it. No external dependencies needed at all for that.


In the next update we'll make it so you can hash a string or other data without having to write it to disk first.


Could I, by any chance, get a quick example usage (since the latest beta is out :smile:)?


Figured it out:

var b = DOpus.Create.Blob();
b.copyFrom('I want to be hashed!');
var hash = DOpus.FSUtil().Hash(b, 'sha1');