I'm working on creating an hmac-sha1 hash in Cerner's proprietary language, CCL. It's similar to PL/SQL and has access to native oracle functions. The idea is to mimic a hash created inside javascript. Oracle is using DBMS_CRYPTO and javascript is using CRYPTO.JS. Below are my two implementations, however I'm unable to get the hashes to match with basic testing strings.
If anyone can shed some light on what I'm doing wrong, I'd appreciate it! I've tried playing around with how I'm giving the data to the dbms_crypto.mac() function, but I'm not able to get it to match.
Javascript output: bad02f0a5324ad708bb8100220bae499e2c127b8
Codepen: https://codepen.io/bookluvr416/pen/jzmVWx
var consumerKey = "testConsumer";
var secretKey = "testSecret";
var valueToSign = consumerKey + secretKey;
var hmac = Crypto.HMAC(Crypto.SHA1, valueToSign.toLowerCase(),
secretKey.toLowerCase(), { asBytes: false });
DBMS_CRYPTO output: 0BCC191B3A941C95ECAA46C8F825394706096E62
PL/SQL Sample that I'm trying to base my CCL on:
DECLARE
typ INTEGER := DBMS_CRYPTO.SH1;
key RAW(100) := 'testsecret';
mac_value RAW(100);
BEGIN
mac_value := DBMS_CRYPTO.MAC('testconsumertestsecret', typ, key);
END;
Caveat - I'm not able to actually test the PL/SQL version, since I don't have an oracle sandbox to play in. I'm also not allowed to post the proprietary code on external websites, so I can't show my actual implementation.