diff --git a/README.md b/README.md index 700c420..9341352 100644 --- a/README.md +++ b/README.md @@ -7,7 +7,7 @@ variety of languages and technologies. These are things that don't really warrant a full blog post. These are mostly things I learn by pairing with smart people at [Hashrocket](http://hashrocket.com/). -_406 TILs and counting..._ +_407 TILs and counting..._ --- @@ -177,6 +177,7 @@ _406 TILs and counting..._ - [Clear The Screen In psql](postgres/clear-the-screen-in-psql.md) - [Clear The Screen In psql (2)](postgres/clear-the-screen-in-psql-2.md) - [Compute Hashes With pgcrypto](postgres/compute-hashes-with-pgcrypto.md) +- [Compute The md5 Hash Of A String](postgres/compute-the-md5-hash-of-a-string.md) - [Configure The Timezone](postgres/configure-the-timezone.md) - [Constructing A Range Of Dates](postgres/constructing-a-range-of-dates.md) - [Count Records By Type](postgres/count-records-by-type.md) diff --git a/postgres/compute-the-md5-hash-of-a-string.md b/postgres/compute-the-md5-hash-of-a-string.md new file mode 100644 index 0000000..a9613eb --- /dev/null +++ b/postgres/compute-the-md5-hash-of-a-string.md @@ -0,0 +1,22 @@ +# Compute The md5 Hash Of A String + +One of the functions provided by PostgreSQL for working with string data is +the `md5()` function. This function calculates the md5 hash of a given string. + +It works like this: + +```sql +> select md5('Hello, World!'); + md5 +---------------------------------- + 65a8e27d8879283831b664bd8b7f0ad4 + +> select md5('$3cr3tp4$$w0rd'); + md5 +---------------------------------- + bbabecfd4031211077473734bae7249f +``` + +There are more hashing algorithms provided by the `pgcrypto` extension. See +[Compute Hashes With pgcrypto](postgres/compute-hashes-with-pgcrypto.md) for +more details on that.