I wish to encrypt an Unicode string by using bitwise operators from my client (Dart) app, and send it to my PostgreSQL server where a function will decrypt it by using bitwise operators. But I don't find any info to respect, is it possible?

NOTE: with Dart I can convert a string into codes and they can be dealt with bitwise operators.

  • Bit strings support Bitwise operators.
    – dwhitemv
    Nov 18, 2022 at 6:23
  • Only to encrypt communication between the client and the database! Why not ssl = on? Nov 18, 2022 at 14:26
  • It is enabled, but I need certain data is not obfuscated if web user tries to use some Inspect tool from client app. Nov 18, 2022 at 15:11
  • You can count on a determined attacker decompiling all client side code, don't give your business secrets to your users.
    – Jasen
    Nov 19, 2022 at 8:48

1 Answer 1


So you receive a string of bytes which has postgresql type bytea,

Perform your bitwise operations on that

using built in bytesting operations. https://www.postgresql.org/docs/15/functions-binarystring.html or using pgcrypto https://www.postgresql.org/docs/current/pgcrypto.html

Then use convert_from( mangled_bytestring,'UTF8') to convert it to unicode text.

text (and varchar etc) in postgresql is represented internally as UTF8 but this is well hidden from the user.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.