MCPcopy
hub / github.com/brianc/node-postgres / postgresMd5PasswordHash

Function postgresMd5PasswordHash

packages/pg/lib/crypto/utils.js:51–55  ·  view source on GitHub ↗
(user, password, salt)

Source from the content-addressed store, hash-verified

49
50// See AuthenticationMD5Password at https://www.postgresql.org/docs/current/static/protocol-flow.html
51async function postgresMd5PasswordHash(user, password, salt) {
52 const inner = await md5(password + user)
53 const outer = await md5(Buffer.concat([Buffer.from(inner), salt]))
54 return 'md5' + outer
55}
56
57/**
58 * Create a SHA-256 digest of the given data

Callers

nothing calls this directly

Calls 1

md5Function · 0.85

Tested by

no test coverage detected