Question
· 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

Discussion (3)0
Log in or sign up to continue

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