Skip to content

Latest commit

 

History

History
197 lines (163 loc) · 8.1 KB

README.md

File metadata and controls

197 lines (163 loc) · 8.1 KB

Habbo Hotel group badges

This documentation explains how badges are structured and how they are hashed.

Badge structure

Badges typically consist of 0-n badge parts. Badge parts are divided in 3 different types:

  • b: Base parts
  • s: Additional parts (1-99)
  • t: Additional parts (100-199)

Both types of badge parts are built using 1 letter and 5 digits:

Type Badge part ID Color Position
b/s/t 00-99 01-24 0-8

All 3 badge parts are optional, but when a badge part is added, it must contain the letter and exactly 5 digits. If your Badge Part ID or Color are below 10, add a leading 0.

The difference between types

The main difference between b and s or t is that b can only display base parts, and the others can only display additional parts. It is also worth noting that a badge can contain multiple base parts.

There's also a slight difference between s and t. There's between 100 and 200 different additional parts available in Habbo, but a badge part only takes 5 digits, so Badge part ID can't be more than 99. To still use an additional part that goes above 99, we can use t. When t is set to 00, that equals Badge part ID 100, 10 equals Badge part ID 110, etc. For Badge part ID 1 to 99, you can use s.

Badge part IDs

A Badge part ID is a 2-digit number that represents a certain image or shape in your badge. Base- and additional parts both have their own IDs. A few of them are displayed below.

Base

ID 1 ID 2 ID 3

Additional

ID 1 ID 2 ID 3

Colors

A Color is a 2-digit number that represents the color of a badge part. There is 24 different colors in total. Note that not all badge parts can be colored. In that case, any number will return the same default color. An example of a non-colorable badge part is displayed below.

Positions & Layers

A Position is a single digit that represents the position of a badge part in your badge. There is 9 different possible positions (0-8), 0 being the upper left corner, 4 being the center and 8 being the bottom right corner. Some bigger badge parts will always be centered, regardless of the set position. A badge demonstrating all possible positions is displayed below.

A badge also has layers. That means that badge parts can overlap other badge parts. A badge part on layer 1 will overlap the part on layer 0, a part on layer 2 will overlap the one on layer 1, etc. What layer a badge part is on, is determined by the order they are in. For example, the order is like this: [part_a][part_b], here, part_a is on layer 0, and part_b is on layer 1. Layers apply to any type of badge part.

Example structures

This list of examples demonstrates how to build structures for a badge.

Correct structures

Image Structure Explained
b03120 A single base part with ID 03, color 12 and position 0
b01200s06104 Base 1 with color 20 and 1 additional part with ID 6, color 10 and position 4
b01200s84033s86034s97035 Same base as above, with 3 additional parts on positions 3, 4 and 5, making the word 'GIT' together
b01030b03030 Example of a badge with multiple base parts
s84033s86034s97035 Same as #3, except this badge doesn't have any base parts
Completely empty structure, results into an empty badge

Structure hashing

Structure hashing is a more technical matter. How it works exactly is explained in this part of the documentation. A Habbo imaging URL typically looks like: :server/habbo-imaging/:imageType/:struct:hash

Where

:server Is the address of the server. For example https://www.habbo.com
:imageType Is the type of image you are requesting. In this case that is 'badge'
:struct Is the badge structure that has been explained here
:hash Is the result hash of this process

Creating a hash

Before being able to create a valid badge URL, you will need to know that Habbo uses a static "secret" MD5 hash in the process. This hash will be used in combination with a badge structure to create a new hash: ef2356a4926bf225eb86c75c52309c32

Formula for creating a valid badge URL: BADGE_STRUCTURE + MD5(BADGE_STRUCTURE + STATIC_HASH)

Where

BADGE_STRUCTURE Is the structure of the badge you want to have returned
STATIC_HASH Is ef2356a4926bf225eb86c75c52309c32

C# code example

This is a C# console application that creates and prints a valid badge URL.

class CreateBadgeHash
{
    static void Main()
    {
        string myStructure = "b10220s06034";
        string staticHash = "ef2356a4926bf225eb86c75c52309c32";

        System.Console.WriteLine(myStructure + CreateMD5(myStructure + staticHash));
    }

    public static string CreateMD5(string input)
    {
        using (System.Security.Cryptography.MD5 md5 = System.Security.Cryptography.MD5.Create())
        {
            byte[] inputBytes = System.Text.Encoding.ASCII.GetBytes(input);
            byte[] hashBytes = md5.ComputeHash(inputBytes);

            System.Text.StringBuilder sb = new System.Text.StringBuilder();
            for (int i = 0; i < hashBytes.Length; i++)
            {
                sb.Append(hashBytes[i].ToString("X2"));
            }
            return sb.ToString();
        }
    }
}