MD5 - Blackberry的在线高分榜。如何?

时间:2014-11-26 01:31:06

标签: c# blackberry md5

我有一个用Unity制作的游戏,它部署在WP商店中,我正在尝试为BB做同样的事情...但是,在检查了所有内容之后我意识到我无法发布我所做的分数,进入DB我在线主持......

我认为这是因为MD5功能,但我不确定哪些是API,BB使用......

有人可以帮我一点,在这里,拜托?

这是我的MD5功能(用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
}

谢谢!

0 个答案:

没有答案