Skip to content

ENCRYPT_KS Examples

Encrypt the nickname column from the team table using key yb100key and the default algorithm:

premdb=# select nickname, encrypt_ks(nickname, yb100key) from team order by teamid limit 5;
 nickname | encrypt_ks  
----------+-------------
 Gunners  | nmFhVu67X3
 Villains | W0khTes1yFE
 Tykes    | Y0VgKW7
 Blues    | qK{jKW7
 Rovers   | aOEjKaN7
(5 rows)

Run the same query but change the algorithm:

premdb=# select nickname, encrypt_ks(nickname, yb100key, 3) from team order by teamid limit 5;
 nickname | encrypt_ks  
----------+-------------
 Gunners  | 5pOQhIRyw1
 Villains | K3vQf2hwd5E
 Tykes    | M38RWAA
 Blues    | 0NfSWAA
 Rovers   | GRPSWEAy
(5 rows)

Parent topic:ENCRYPT_KS