{"id":18792188,"url":"https://github.com/johto/pgspeck","last_synced_at":"2025-04-13T14:31:05.859Z","repository":{"id":35979308,"uuid":"40270743","full_name":"johto/pgspeck","owner":"johto","description":"Small block size Speck encryption in PostgreSQL","archived":false,"fork":false,"pushed_at":"2023-10-24T10:08:07.000Z","size":32,"stargazers_count":17,"open_issues_count":1,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2023-10-24T11:23:57.844Z","etag":null,"topics":["encrypt","encryption","obfuscation","pg","postgresql","speck"],"latest_commit_sha":null,"homepage":"","language":"C","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/johto.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null}},"created_at":"2015-08-05T21:58:10.000Z","updated_at":"2023-03-07T10:34:41.000Z","dependencies_parsed_at":"2023-01-16T10:34:55.696Z","dependency_job_id":"deb22b75-d350-4f96-9c51-9021ccebda4c","html_url":"https://github.com/johto/pgspeck","commit_stats":null,"previous_names":[],"tags_count":0,"template":null,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/johto%2Fpgspeck","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/johto%2Fpgspeck/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/johto%2Fpgspeck/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/johto%2Fpgspeck/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/johto","download_url":"https://codeload.github.com/johto/pgspeck/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":223589453,"owners_count":17169973,"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":["encrypt","encryption","obfuscation","pg","postgresql","speck"],"created_at":"2024-11-07T21:18:45.943Z","updated_at":"2024-11-07T21:18:48.257Z","avatar_url":"https://github.com/johto.png","language":"C","funding_links":[],"categories":[],"sub_categories":[],"readme":"pgspeck\n=======\n\npgspeck is a PostgreSQL extension for symmetrical encryption using the\n[Speck](https://en.wikipedia.org/wiki/Speck_(cipher)) encryption algorithm.\nOnly 32-bit and 48-bit block sizes, and 64-bit and 96-bit keys (respectively)\nare supported.  The primary use case is generating a random-looking sequence\nfrom an increasing sequence.  Requires PostgreSQL version 9.1 or later.\n\nExample usage:\n\n```SQL\nCREATE FUNCTION my_secret_key()\nRETURNS int8 IMMUTABLE\nAS $$\n    SELECT 1234567890987654321\n$$ LANGUAGE sql;\n\nCREATE SEQUENCE userid_plaintext_seq;\n\nCREATE TABLE users (\n    userid bigint NOT NULL\n        DEFAULT pgspeck_encrypt32(nextval('userid_plaintext_seq'), my_secret_key()),\n    PRIMARY KEY (userid)\n);\n\n=# INSERT INTO users DEFAULT VALUES RETURNING *;\n   userid\n------------\n 3497276207\n(1 row)\n\nINSERT 0 1\n=# INSERT INTO users DEFAULT VALUES RETURNING *;\n   userid\n------------\n 1514490635\n(1 row)\n\nINSERT 0 1\n```\n\nThe extension adds four functions:\n\n```SQL\n-- Encrypts a 32-bit plaintext using a 64-bit key.  Only the lowermost 32 bits\n-- of the plaintext are used.  For the key, the full 64-bit range is effective.\nCREATE FUNCTION pgspeck_encrypt32(plaintext int8, key int8)\n\tRETURNS int8\n\tAS 'pgspeck', 'pgspeck_encrypt32' LANGUAGE c STRICT;\n\n-- Decrypts a value encrypted with pgspeck_encrypt32.\nCREATE FUNCTION pgspeck_decrypt32(ciphertext int8, key int8)\n\tRETURNS int8\n\tAS 'pgspeck', 'pgspeck_decrypt32' LANGUAGE c STRICT;\n\n-- Encrypts a 48-bit plaintext using a 96-bit key.  Only the lowermost 48 bits\n-- of each key component can be non-zero.\nCREATE FUNCTION pgspeck_encrypt48(plaintext int8, key1 int8, key2 int8)\n\tRETURNS int8\n\tAS 'pgspeck', 'pgspeck_encrypt48' LANGUAGE c STRICT;\n\n-- Decrypts a value encrypted with pgspeck_encrypt48.\nCREATE FUNCTION pgspeck_decrypt48(ciphertext int8, key1 int8, key2 int8)\n\tRETURNS int8\n\tAS 'pgspeck', 'pgspeck_decrypt48' LANGUAGE c STRICT;\n```\n\nThis software is released under the MIT license.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjohto%2Fpgspeck","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjohto%2Fpgspeck","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjohto%2Fpgspeck/lists"}