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?

  • 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
  • 2
    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
  • 1
    There are a few problems with this question: 1) you have no clear goal to measure against, 2) it does not appear that you have looked at all the standard hashing and digital signature processes as they are designed to address all the uncertainties you have for your algorithm. – schroeder Nov 1 '17 at 13:57
  • 1
    Big rule of writing your own encryption: if at any point you think "In fact, it might compromise security, I don't know." -- the answer is "yes, it will", unfortunately. – Bryan Boettcher Nov 1 '17 at 20:29

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.