How to implement bcrypt algorithm

Answers

Hi,

our implementations of encryption and hash algorithms can be accessed through the %SYSTEM.Encryption class. Unfortunately we currently don't have a bcrypt implementation.

HTH

-Fab

 

Hi,

 

There is a bcrypt module in Python is that's any help.It would be very easy to call out to a python script from Cache.

 

HTH

 

Mike

Recently I stumbled upon the same problem, the need to use bcrypt from within caché. I did the following:

1. Install pip, the python package manager:
http://sharadchhetri.com/2014/05/30/install-pip-centos-rhel-ubuntu-debian/

 

2. Install bcrypt with pip

sudo pip install bcrypt

 

3. Call bcrypt from Caché Code. The Encrypted String is pOutput

BCrypt
    Set password = "password"
    set tSC = ##class(EnsLib.JavaGateway.Service).RunCommandViaCPIPE("python -c 'import bcrypt; print(bcrypt.hashpw("_$c(34)_password_$c(34)_", bcrypt.gensalt()))'",.pDevice,.pOutput)
    Write pOutput,!
    Quit