I have the following idea for a hash algorithm:

  • Take a string called string.
  • Hash it and get hash.
  • Insert (uniformly? randomly? in a pattern based on some value of the hash itself? something more complicated that I can't think of?) the characters of string into hash and get string+hash.
  • Encrypt string+hash using hash as the key

In other words:
encrypt(hash(string), hash(string) + string)

I have no idea if this works, or if it actually accomplishes anything in terms of additional security. In fact, it might compromise security, I don't know.

Is this any less reversible/less likely to create collisions/better in some way than just hashing and leaving it alone?

It should still be easy to do forward because all the user inputs is plaintext if I'm understanding this correctly. But by inserting the actual data and then encrypting, doesn't that make it harder to extrapolate anything useful from the decrypted hash+string mess?

Or does using the hash as the key compromise the data? Or (as is probably much more likely if this is validly useful) does this already exist?

closed as unclear what you're asking by Xander, Anders, Steve, schroeder Nov 1 '17 at 13:50

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.

  • Please try to reformulate this into a single, clear question. – Jonathan Cross Oct 31 '17 at 22:41
  • 3
    Is this question itself a cipher? – Cthulhu Oct 31 '17 at 22:42
  • using the hash as a key is a bad idea. you can use a hash-based derivation like pbkdf. – dandavis Oct 31 '17 at 23:29
  • 1
    It's unclear what you are asking about. What you are proposing is clear: take a hash of some data and use that hash value to encrypt the concatenation of the data and the hash. It is just not clear what you want help comparing this process to and unclear what the point of doing it is. Are you trying to come up with a better hashing process? A "simpler" encryption process? What is the point? – hft Nov 1 '17 at 1:01
  • This is not a hash algorithm if you are using a hash algorithm as part of it. This is just an algorithm. – schroeder Nov 1 '17 at 13:52

I really don't know what you mean by the 3rd point in your post.

All this would do is take more time to essentially hash the string in a complicated way. It would also take more time for someone to find the string of the hash via bruteforcing, but then again you can achieve the same effect by hashing a string multiple times or just using a resource intensive hash function.

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