Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is it possible to hash using MD5 in BigQuery?

Does BigQuery have MD5() functionality? I know it has cityhash but I need MD5 specifically. thanks!

like image 648
user3590389 Avatar asked Apr 30 '14 17:04

user3590389


2 Answers

Since this shows up in Google searches for "BigQuery MD5", for instances, it's worth pointing out that BigQuery supports the following hashing functions natively in standard SQL:

  • MD5
  • SHA1
  • SHA256
  • SHA512
like image 83
Elliott Brossard Avatar answered Sep 22 '22 23:09

Elliott Brossard


No, but bigquery does have some sha1-hash support. The SHA1() function returns bytes, but you can convert this to base64 by using TO_BASE64() which will give you a nice string or STRING() which will give you an ugly one:

SELECT TO_BASE64(SHA1(corpus)) from [publicdata:samples.shakespeare] limit 100;
like image 36
Jordan Tigani Avatar answered Sep 23 '22 23:09

Jordan Tigani