/FriendlySeeds

Have a long numerical Minecraft seed? Use this tool to turn it into a short shareable collection of letters.

Primary LanguageJavaScript

FriendlySeeds

FriendlySeeds is a tool that converts numerical Minecraft seeds to letters. Have a numerical Minecraft seed that you want to share? Use this tool to convert that number into a shareable collection of letters! This tool works for both Minecraft Java Edition and Minecraft Bedrock Edition.

For example: The seed 12345678 converts to AMhhAFRO

The tool can be accessed here

How does it work?

Under the hood, Minecraft uses Java's String.hashCode() method to convert words into actual numbers that can be used for world generation. This tool reverses that method to turn a long numerical seed (from the output of /seed for example) into a shareable collection of letters. This also works for Minecraft Bedrock Edition, which uses the exact same method to convert words into numbers.

Unfortunately, String.hashCode() returns an int, which can only be between -2,147,483,648 and 2,147,483,647. Actual world seeds are of type longand can be much larger. This is why this tool cannot take in numerical seeds outside of this range.

String.hashCode() is also not cryptographically secure, meaning that the string representation generated by this tool is not the only possible representation for any particular seed.

This tool takes advantage of a flaw in String.hashCode() in order to quickly generate representations of numerical seeds. It turns out that x.hashCode()*31x.length()+y.hashCode()=(x+y).hashCode() where x and y are both strings of the same length. This tool tests a bunch of combinations of characters and adds them to a HashMap. The HashMap is then searched to find a suitable y that can be concatenated with the most recently generated string to produce the desired numerical seed.

Most of the time, this algorithm generates seed representations that are 8 characters long.

Contributing

Feel free to file an issue or Pull Request. I am currently looking into techniques for finding shorter seed representations by modifying the above technique.