LoginSignup
3
0

More than 5 years have passed since last update.

GitHub Identiconでライフゲームする-その1~Identiconについて~

Last updated at Posted at 2017-12-21

はじめに

4記事目になりました。(下書きに置きっ放しでだいぶ遅くなってしまった。。)
超離散のお話は一旦休憩。時間があれば戻ります。
2回分くらい使って、GitHubの初期Iconでライフゲームする(予定)。
本稿では、GitHubの初期Iconがどのように生成されているのかを紹介します。

Motivation

Icon変えたいなーと思っていたらこんな記事を見つけたので、MacUserの自分にも動かせるように作ろうと...
(GitHub の自動生成されたユーザーアイコンでライフゲーム)
ちなみに, JavaFXで作る予定です。

Identicon

GitHubの初期IconはIdenticonというものだそう。
https://github.com/blog/1586-identicons
まず、Identiconとは何なのか。

From Wikipedia:
An Identicon is a visual representation of a hash value, usually of an IP address, that serves to identify a user of a computer system as a form of avatar while protecting the users' privacy.

つまり、IPアドレスなんかの個々を識別するための値を、可視化したもの。こんなのです。↓
identicon

GitHubのIdenticon

自分のIconはGitHubの初期Iconから変えていないので、これもIdenticon。
14970374.png
GitHubのIdenticonは、正方形を$5\times5$に並べたもの。
色のついた正方形をおく場所と、その色によって差別化が図られています。

生成方法

GitHubのIdenticonは以下の方法で生成されている(らしいです)。
1. GitHubのUserIDをMD5(wikipedia)で128bitのHash値に変換。
(UserIDは http://caius.github.io/github_id/ でわかります。)
2. 形を決める。左右対称なので、左から3列目までを決めればよい。3→2→1列目の順で上から下に、変換後の先頭15文字の偶奇で決める(偶数ならそこに色をつける)。
3. 128bitの末尾 7 文字を使って色を決める。
(詳しくは http://blog.atgw.jp/archives/3025)

ちなみに...

GitHubのIdenticonは

https://identicons.github.com/(User名).png

に残っているそうです。Iconを変えてしまった人は、お試しあれ。

3
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
3
0