{"id":23413010,"url":"https://github.com/cgivre/drill-crypto-functions","last_synced_at":"2025-04-09T04:24:33.825Z","repository":{"id":76248986,"uuid":"95240005","full_name":"cgivre/drill-crypto-functions","owner":"cgivre","description":"A collection of UDFs for Apache Drill that implement common cryptographical functions.","archived":false,"fork":false,"pushed_at":"2017-07-05T04:10:15.000Z","size":32,"stargazers_count":2,"open_issues_count":1,"forks_count":1,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-02-14T22:42:54.117Z","etag":null,"topics":["aes-encryption","apache-drill","md5","sha1","sha256","sql"],"latest_commit_sha":null,"homepage":"","language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/cgivre.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2017-06-23T17:04:26.000Z","updated_at":"2019-03-19T09:18:27.000Z","dependencies_parsed_at":null,"dependency_job_id":"2792e0c7-e8ba-4178-9acf-7e2cf008d3f7","html_url":"https://github.com/cgivre/drill-crypto-functions","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cgivre%2Fdrill-crypto-functions","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cgivre%2Fdrill-crypto-functions/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cgivre%2Fdrill-crypto-functions/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cgivre%2Fdrill-crypto-functions/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/cgivre","download_url":"https://codeload.github.com/cgivre/drill-crypto-functions/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247976745,"owners_count":21027158,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["aes-encryption","apache-drill","md5","sha1","sha256","sql"],"created_at":"2024-12-22T18:27:24.037Z","updated_at":"2025-04-09T04:24:33.808Z","avatar_url":"https://github.com/cgivre.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Drill Crypto Functions\n\nThis library contains a collection of cryptography-related functions for Apache Drill. It generally mirrors the crypto functions in MySQL.  The package includes:\n\n\n* **`aes_encrypt()`/ `aes_decrypt()`**: implement encryption and decryption of data using the official AES (Advanced Encryption Standard) algorithm, previously known as “Rijndael.”\n `AES_ENCRYPT()` encrypts the string `str` using the key string `key_str` and returns a binary string containing the encrypted output. `AES_DECRYPT()` decrypts the encrypted string `crypt_str` using the key string `key_str` and returns the original cleartext string. If either function argument is NULL, the function returns NULL.\n\n```sql\n\u003e SELECT aes_encrypt( 'encrypted_text', 'my_secret_key' ) AS aes FROM (VALUES(1));\n+---------------------------+\n|            aes            |\n+---------------------------+\n| JkcBUNAn8ByKWCcVmNrKMA==  |\n+---------------------------+\n\n \u003e SELECT aes_encrypt( 'encrypted_text', 'my_secret_key' ) AS encrypted,\n aes_decrypt(aes_encrypt( 'encrypted_text', 'my_secret_key' ),'my_secret_key') AS decrypted \n FROM (VALUES(1));\n+---------------------------+-----------------+\n|         encrypted         |    decrypted    |\n+---------------------------+-----------------+\n| JkcBUNAn8ByKWCcVmNrKMA==  | encrypted_text  |\n+---------------------------+-----------------+\n```\n\n* **`md2(\u003ctext\u003e)`**:  Returns the md2 hash of the text. (https://en.wikipedia.org/wiki/MD2_(cryptography))\nUsage:\n```sql\n\u003e select md2( 'testing' ) from (values(1));\n+-----------------------------------+\n|              EXPR$0               |\n+-----------------------------------+\n| fc134df10d6ecafceb5c75861d01b41f  |\n+-----------------------------------+\n```\n\n* **`md5(\u003ctext\u003e)`**:  Returns the md5 hash of the text. (https://en.wikipedia.org/wiki/MD5)\nUsage:\n```sql\n\u003e select md5( 'testing' ) from (VALUES(1));\n+-----------------------------------+\n|              EXPR$0               |\n+-----------------------------------+\n| ae2b1fca515949e5d54fb22b8ed95575  |\n+-----------------------------------+\n```\n* **`sha(\u003ctext\u003e`) / `sha1(\u003ctext\u003e)`**: Calculates an SHA-1 160-bit checksum for the string, as described in RFC 3174 (Secure Hash Algorithm). (https://en.wikipedia.org/wiki/SHA-1)  The value is returned as a string of 40 hexadecimal digits, or NULL if the argument was NULL. Note that `sha()` and `sha1()` are aliases for the same function. \n```sql\n\u003e select sha1( 'testing' ) from (VALUES(1));\n+-------------------------------------------+\n|                  EXPR$0                   |\n+-------------------------------------------+\n| dc724af18fbdd4e59189f5fe768a5f8311527050  |\n+-------------------------------------------+\n```\n* **`sha2(\u003ctext\u003e`) / `sha256(\u003ctext\u003e)`**: Calculates an SHA-2 256-bit checksum for the string. (https://en.wikipedia.org/wiki/SHA-2)  The value is returned as a string of hexadecimal digits, or NULL if the argument was NULL. Note that `sha2()` and `sha256()` are aliases for the same function. \n```sql\n\u003e select sha2( 'testing' ) from (VALUES(1));\n+-------------------------------------------------------------------+\n|                              EXPR$0                               |\n+-------------------------------------------------------------------+\n| cf80cd8aed482d5d1527d7dc72fceff84e6326592848447d2dc0b0e87dfc9a90  |\n+-------------------------------------------------------------------+\n```\nAdditionally, there are also `sha384(\u003ctext\u003e)` and `sha512(\u003ctext\u003e)` functions which return SHA-2 hashes with 384 and 512 bit checksums.\n\n## Installing These Functions\nThis collection of functions does not have any dependencies that are not already included in Drill.  You can build the functions from source by cloning this repository, navigating to the directory and typing: \n`mvn clean package -DskipTests`.\nOnce you've done that, you'll find two `.jar` files in the `target/` folder.  Copy both these files to `\u003cdrill path\u003e/jars/3rdParty`.\n\nThese functions will be included in Drill 1.11.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcgivre%2Fdrill-crypto-functions","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcgivre%2Fdrill-crypto-functions","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcgivre%2Fdrill-crypto-functions/lists"}