-2

Is it possible to encrypt a value (such as "hello world") with itself ("hello world") using an encrypting technique such as SHA256? Is that safe to do or would it be easily compromised?

closed as unclear what you're asking by Steffen Ullrich, ThoriumBR, Matthew, DKNUCKLES, Teun Vink Aug 31 '18 at 12:21

Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.

  • 2
    SHA256 is a hash algorithm, not an encryption algorithm. It's not even possible to do this as SHA256 doesn't use a key. – AndrolGenhald Aug 28 '18 at 20:53
  • 2
    I also don't understand the point... "I'm going to send you a secret message, but in order to open it, you have to already know what it is". What's the bigger goal you're trying to accomplish? – Mike Ounsworth Aug 28 '18 at 20:56
  • 1
    Encrypting something with itself as the key is sometimes suggested as a home-made hashing solution, so if that's what you're after there's an answer for you (and that answer is don't do it). – AndrolGenhald Aug 28 '18 at 21:42
4

Is it possible to encrypt a value (such as "hello world") with itself ("hello world") [...]

Is it possible, but not recommended in practice (see below).

using an encrypting technique such as SHA256?

No, SHA256 is not an encryption algorithm. SHA256 is used for hashing. Maybe you meant to write AES256 rather than SHA256?

Is that safe to do or would it be easily compromised?

It's not safe to do in a practical way since you would need to retain the key to decrypt the data, but since the key is the data in your proposed scheme that would mean that this proposed encryption scheme completely defeats its own purpose!

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