MD5 - Online Highscore table for Blackberry. How to?

120 Views Asked by At

I have a game made with Unity which is deployed in the WP store and I am trying to do the same for BB... however, after checking everything I have realized that I can´t post the score I have made, into the DB I host online...

I think it is because of the MD5 function but I am not sure which are the APIs, BB uses...

Can anyone help me out a little, here, please?

This is the MD5 function I have (written in C#)

using UnityEngine;
using System.Collections;
using System.Text;
using System;
#if UNITY_WP8
using System.Security.Cryptography;
using UnityEngine.Windows;
using UnityEngine.WindowsPhone;
#else
using System.Security.Cryptography;
#endif

public static class Md5Functions
{

#if UNITY_WP8

    static string md5val;

    // Use this for initialization
    static void Start () {
        md5val = Md5Sum("Hello World!");
    }

    static void OnGUI()
    {
        GUILayout.Label(md5val);
    }

    public static string Md5Sum(string strToEncrypt)
    {
        System.Text.UTF8Encoding ue = new System.Text.UTF8Encoding();
        byte[] bytes = ue.GetBytes(strToEncrypt);

        byte[] hashBytes = Crypto.ComputeMD5Hash(bytes);
        string hashString = "";

        for (int i = 0; i < hashBytes.Length; i++)
        {
            hashString += System.Convert.ToString(hashBytes[i], 16).PadLeft(2, '0');
        }

        return hashString.PadLeft(32, '0');
    }
#else
    public static string Md5Sum(string strToEncrypt)
    {
        System.Text.UTF8Encoding ue = new System.Text.UTF8Encoding();
        byte[] bytes = ue.GetBytes(strToEncrypt);

        // encrypt bytes
        System.Security.Cryptography.MD5CryptoServiceProvider md5 = new System.Security.Cryptography.MD5CryptoServiceProvider();
        byte[] hashBytes = md5.ComputeHash(bytes);

        // Convert the encrypted bytes back to a string (base 16)
        string hashString = "";

        for (int i = 0; i < hashBytes.Length; i++)
        {
            hashString += System.Convert.ToString(hashBytes[i], 16).PadLeft(2, '0');
        }

        return hashString.PadLeft(32, '0');
    }
#endif
}

Thanks!

0

There are 0 best solutions below