2

A quick search only yields this for MD5: http://code.kx.com/q/ref/strings/#md5

Are there any other ways to implement SHA1/SHA256 without writing it yourself?

Thomas Smyth - Treliant
  • 4,993
  • 6
  • 25
  • 36
kenwjj
  • 341
  • 1
  • 7
  • 21

2 Answers2

4

There is nothing inbuilt in kdb for that. You need to use external libraries and write an extension (for ex in C) to use that.

Below link has implementation to use OpenSSL library (which has functions for SHA*) in KDB.

https://github.com/johnanthonyludlow/kdb/tree/master/QCrypt

Pdf in that link explains how to use that.

Rahul
  • 3,914
  • 1
  • 14
  • 25
1

There is now a function for this in the .Q namespace: .Q.sha1 x returns the bytestream of the SHA-1 hash of the x, where x is a string.

You can use the .Q unreference card to view the documentation of this and other utility functions which are in the .Q namespace and not in the default namespace.

Akshay Damle
  • 1,220
  • 3
  • 18
  • 31