Step 1. Add the JitPack repository to your build file
Add it in your root settings.gradle at the end of repositories:
dependencyResolutionManagement {
repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
repositories {
mavenCentral()
maven { url 'https://jitpack.io' }
}
}
Add it in your settings.gradle.kts at the end of repositories:
dependencyResolutionManagement {
repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
repositories {
mavenCentral()
maven { url = uri("https://jitpack.io") }
}
}
Add to pom.xml
<repositories>
<repository>
<id>jitpack.io</id>
<url>https://jitpack.io</url>
</repository>
</repositories>
Add it in your build.sbt at the end of resolvers:
resolvers += "jitpack" at "https://jitpack.io"
Add it in your project.clj at the end of repositories:
:repositories [["jitpack" "https://jitpack.io"]]
Step 2. Add the dependency
dependencies {
implementation 'com.github.lelloman:android-identicons:v12'
}
dependencies {
implementation("com.github.lelloman:android-identicons:v12")
}
<dependency>
<groupId>com.github.lelloman</groupId>
<artifactId>android-identicons</artifactId>
<version>v12</version>
</dependency>
libraryDependencies += "com.github.lelloman" % "android-identicons" % "v12"
:dependencies [[com.github.lelloman/android-identicons "v12"]]
An Android library for generating Identicons — unique, deterministic visual identifiers derived from hash values. Supports both traditional XML Views and Jetpack Compose.
Two styles are available:
![]()
![]()
The library is distributed via JitPack. Min SDK is 21.
In your settings.gradle.kts, add the JitPack repository:
dependencyResolutionManagement {
repositories {
google()
mavenCentral()
maven("https://jitpack.io")
}
}
In your module's build.gradle.kts:
implementation("com.github.lelloman:android-identicons:v12")
import com.lelloman.identicon.compose.ClassicIdenticon
import com.lelloman.identicon.compose.GithubIdenticon
// hash is a ByteArray (e.g. from MD5, SHA, or any byte source)
ClassicIdenticon(
hash = myHash,
modifier = Modifier.size(96.dp)
)
GithubIdenticon(
hash = myHash,
modifier = Modifier.size(96.dp)
)
<com.lelloman.identicon.view.ClassicIdenticonView
android:layout_width="96dp"
android:layout_height="96dp"
app:hash="1867167182" />
<com.lelloman.identicon.view.GithubIdenticonView
android:layout_width="96dp"
android:layout_height="96dp"
app:hash="654984321" />
The hash XML attribute accepts an integer, which is internally converted to a ByteArray via MD5. You can also set the hash programmatically:
identiconView.hash = myByteArrayHash
For custom rendering you can use the drawable classes directly:
val drawable = ClassicIdenticonDrawable(width, height, hash)
drawable.draw(canvas)
The input ByteArray is interpreted bit by bit to determine tile shapes, rotations, inversion flags, and the foreground color. When an Int is used (e.g. from the XML attribute), it is first hashed with MD5 to produce a 16-byte array, expanding the visual space.
They can also make good textures for hum carpets, or tiles for the bathroom
![]()