SQLize Online / PHPize Online  /  SQLtest Online

A A A
Share      Blog   Popular
Copy Format Clear
create extension pgcrypto; -- Создание функции для шифрования CREATE OR REPLACE FUNCTION asymmetric_encrypt(data text, public_key text) RETURNS text AS $$ BEGIN RETURN encode(pgp_pub_encrypt_bytea(data::bytea, public_key::bytea, 'compress-algo=1, cipher-algo=aes256'), 'escape'); END; $$ LANGUAGE plpgsql; -- Создание функции для расшифровки CREATE OR REPLACE FUNCTION asymmetric_decrypt(encrypted_data text, private_key text) RETURNS text AS $$ BEGIN RETURN pgp_pub_decrypt_bytea(decode(encrypted_data, 'escape')::bytea, private_key::bytea)::text; END; $$ LANGUAGE plpgsql; create table test1 (id serial, tex1 text); insert into test1 (tex1) values (asymmetric_encrypt('text_text__text', ' OyhldCT7TSAA2CY+SZCYVP6oEa9unnjeHryZ43zvCGJ9PL6g2gDVE771cbKDPjs/ 5fDMOLTurgefxwvB5CABjnR8ecBhuaghxYNG+f5o7cJVHCL57sFvFxc8H/UUUzH4 RuoLoW1iwwYVVu4KuQENBGVOBU8BCAC78pi2nAeRAAIWxmhcGZGQi2nUau4uJUuN a3xbs+bDwxILTwsg+Sek9Zb4/+UOGabs2X9JWCE5gk5Q1kBFXgKuYJ7B2+sMJE5j Yt0sskpXMVX6HqOAVneMPTURdmO8FKpIaxoYjGTCKedmEgneiz9mRG/WAEx98vfB KeVI6NWM5C82XGz+TNiXhY77MrnP6a4tATia58UyUBv3eZi9nbyKqn+MEElcn63t 7lSvKyr5+dLkTnY1b8tPAL/7LgETAzk4F+nuDUlUSxzu6nsHizQ5S/8YOn7sWc0Q yNKfVO7NhJm55g0EMIOYg2GsIDuDEBG1+uLoJCcPwHM7YNK3AxzDABEBAAGJAR8E '))

Stuck with a problem? Got Error? Ask ChatGPT!

Copy Clear