def djb2_hash(s):
    hash = 5381
    for c in s:
        hash = ((hash << 5) + hash) + ord(c)  # hash * 33 + c
    return hash & 0xFFFFFFFF  # Ensure it's a 32-bit unsigned integer

def generate_password(seed, chip_id):
    combined = (seed + chip_id)[:24]  # Ensure the combined string is up to 24 characters
    hash_value = djb2_hash(combined)
    hash_str = f"{hash_value:08X}{hash_value:08X}"  # Repeat the hash to ensure at least 16 characters
    return hash_str[:32]  # Ensure the password is at most 32 characters

if __name__ == "__main__":
    SEED = "ilikekgg"
    chip_id = input("Enter the Chip ID in hex (e.g., 1A2B3C4D): ").strip()
    chip_id = chip_id.zfill(8).upper()  # Ensure it's 8 characters, upper case

    password = generate_password(SEED, chip_id)
    print(f"Generated Password: {password}")
