Generate IPNS id from a universally unique identifier such as an email - is this possible?

It is my understanding that the format of an IPFS hash has many headers in it that define stuff like:

  • which version of the protocol to use
  • which hash algorithm to use
  • which base to use
  • other headers for lengths and other stuff

I understand that a IPNS hash is pretty similar

My question is:

Is it theoretically possible to generate a IPNS hash from a universally unique identifier such as an email?

I suspect that in the existing protocol for an IPNS id, there is some code which creates a random hash. Could we replace that functionality with creating the hash from an email instead?

i.e. is it theoretically possible to pass a universally unique identifier such as an email address, to a function which generates a universally unique IPNS id? If we run the function a second time with the same email it produces the same IPNS - is this possible?

If it is possible does anyone know of any existing code that does that? I prefer Java code but any code is cool.

If this is possible it opens up a lot of possibilities.

Thank you in advance for any help anyone can give.

If it existed, any person (read adversary) could generate the same IPNS “hash” and publish messages in your name (!)
What you can do is sign a message containing your email with you IPNS identity, but the IPNS hash will be the central identity.
If you want email to be the central identity, you need to prove that you are owning it. You can send an email with your IPNS identity for exemple.

Thanks for your reply.

What If the input was “email:password” then only people who knew both the email and password could publish messages. Is that correct?

It would be as secure as the password, yes, but how would other people make use of that? They have no way of verifying that the hash is linked to Also, anyone can generate a hash with + random string with the string supposed to be the password.

Thank you Akita for your time and dealing with possibly super dumb questions.

Can you think of a way to convert:

to a IPFS cid so that an associated file can be retrieved without knowing the cid up front. Anyone can download the file but only one person can be able to create or update the file.

It was this requirement that made me start thinking about how IPNS cid are created.


IPNS keys are random (and tied to a node). When you generate an IPNS key you can pass a key name but it’s only a local identifier so that won’t help.

Regarding your last question, i understand what you’re trying to achieve, let me share my thoughts. If you were to import the content in IPFS, you’ll get a unique CID (assuming you always use the same hash algo), and then anyone on the network can check that someone added this email (you just need to compute the hash corresponding to this email, by using ipfs add in hash-only mode, adding the string namespace:email, then fetch this CID). This part works because the email is known and static.

Associating a file to this email will not work because once you associate another CID to this CID, the resulting CID of the file will be unpredictable :slight_smile: (welcome to immutability …). Using a raw DAG doesn’t change the problem.

What you can do however, is for example associate a raw DAG to an IPNS key, and store the emails and the associated CIDs in the raw DAG (you could even have a list of CIDs per email). Then people knowing the IPNS key can do ipfs get /ipns/key/ That means you have to communicate the IPNS key/domain. You could also use an OrbitDB database for this.

Good luck.

Thank you very much for your time and answer reload.