Question Jose Antonio Cañizares · Sep 2, 2016

How to implement bcrypt algorithm

Hi all,

Is there any bcrypt algorithm on HealthShare? We are trying to use it but ww couldn't find it.

Regards

Comments

Fabian Haupt · Sep 2, 2016

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

0
Mike Dawson · Sep 2, 2016

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

0
Gery Gerena · Feb 3, 2017

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-debi…

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
0