Hashing with SHA-256 in Javascript

importPackage(java.io); importPackage(Packages.java.lang); importClass(java.security.MessageDigest); importClass(java.nio.charset.StandardCharsets); importClass(java.lang.StringBuffer); var varMyString = “JIMBO”; var varDigest = MessageDigest.getInstance(“SHA-256”); var varOriginalString = new java.lang.String(varMyString); var varHashedString = varDigest.digest(varOriginalString.getBytes(StandardCharsets.UTF_8)); var varFinalString = new StringBuffer(); for (i = 0; i < varHashedString.length; i++) { varFinalString.append(Integer.toString((varHashedString[i] & 0xff) + 0x100, 16).substring(1)); } print (“hash: ” + varFinalString);

Encrypt data using Public Key

Often times you will want to scramble data before you store it in an LDAP directory or a database. The quickest method is to simply obfuscate the data by replacing each character in the original data with different ones, of course by using a known algorithm. For example, shifting the characters over two places on the ASCII scale before replacement. … Read More

JDE Julian Date conversion

Below you will find a JavaScript program which will convert JD Edwards Julian Dates to Java dates. The output format can be tweaked to your liking.

The code handles LEAP year conversion, as the following examples show. 2004 is a LEAP year, 1971 is not. Kekes-MacBook-Pro:Downloads karmst$ rhino -f jimbo.js JDE Date: 104138 Out Date: 20040517 Kekes-MacBook-Pro:Downloads karmst$ rhino … Read More

Call PowerShell from IDM engine (Windows only)

If you have your NetIQ IDM Engine on eDirectory which is running on a Windows Server, then you might just want to call PowerShell directly from the Engine; at least you have the capability of doing so. The following code snippets (both DirXML Script and ECMAScript) will allow you to do just that. Of course, this only works on Windows, … Read More

A perl script to convert from Excel to LDIF

Overview We have developed a simple solution which allows for the conversion of a Microsoft Excel file to an LDIF file. The resulting LDIF file can then be easily imported into Novell eDirectory. Some of the features are: Written in Perl, so completely cross platform Reads Excel files in the Microsoft Excel 2007 and 2010 file format Ignore list functionality … Read More