githubidenticon

official GitHub identicon algorithm


I want to get the official GitHub implementation of the identicon algorithm. Where can i find that? Thank you.

I've found a lot of tutorials. but they all are not the official implementation. How can I do this?


Solution

  • As stated in an answer of this Twitter Post, there is no official release but an employee of GitHub ported it to rust and published it here. The number from that you need to enter there is the id of your user. You can get it by running a request to https://api.github.com/users/<username> (the field is named id).

    After building it, you can test it using the following command (bash, $ghUserId):

    echo -n "$ghUserId" | ./target/debug/identicon > identicon.png
    

    In order to get the user id from the username and calculate the identicon in one command, you can use this (if you have installed jq, $githubUserName is a variable with the user name):

    curl "https://api.github.com/users/$githubUserName" | jq .id | ./target/debug/identicon > identicon.png
    

    Also note that I used ./target/debug/identicon as the executable as I found it here after building it.

    You can also get the identicon from https://github.com/identicons/<username>.png as stated in this blog post.