Get started

Command line application

Install the Jdenticon-net NuGet package.

PM> Install-Package Jdenticon-net

Use the Identicon class to create identicons.

using Jdenticon;

class Program
{
    static void Main() 
    {
        Identicon
            .FromValue("string to hash", size: 100)
            .SaveAsPng("test.png");
    }
}

ASP.NET MVC

To use Jdenticon on a ASP.NET MVC site, start by installing the Jdenticon.AspNet.Mvc NuGet package.

PM> Install-Package Jdenticon.AspNet.Mvc

Now you can render icons on any page by using the following code:

@using Jdenticon.AspNet.Mvc;

<div>
    Icon: @Html.Identicon("Value to be hashed", size: 100, alt: "Icon")
    Icon: <img src="@Url.Identicon("Value to be hashed", size: 100)" alt="Icon" width="100" height="100" />
</div>

ASP.NET WebApi

This example demonstrates how to use Jdenticon from a WebApi controller. Start by installing the Jdenticon.AspNet.WebApi NuGet package.

PM> Install-Package Jdenticon.AspNet.WebApi

From your API controller, return an instance of an IdenticonResult.

using Jdenticon.AspNet.WebApi;
                
public class IdenticonController : ApiController
{
    public IdenticonResult Get()
    {
        return IdenticonResult.FromValue("Value to be hashed", size: 100);
    }
}

Provided that you have kept the default API route in your application, you may now access the sample icon at the url http://localhost:<port>/api/identicon.

ASP.NET WebForms

To use Jdenticon on a ASP.NET WebForms site, start by installing the Jdenticon.AspNet.WebForms NuGet package.

PM> Install-Package Jdenticon.AspNet.WebForms

Now you can render icons on any page by using the following code:

<div>
    Icon: <jdenticon:Icon runat="server" StringValue="Value to be hashed" Size="100" />
</div>