Преобразование MD5 в BigInt на Amazon RedshiftC#

Место общения программистов C#
Anonymous
Преобразование MD5 в BigInt на Amazon Redshift

Сообщение Anonymous »

У меня есть следующий код C#:

Код: Выделить всё

using System;
using System.Collections.Generic;
using System.Security.Cryptography;
using System.Text;

public class Program
{
public static void Main()
{
string profileId = "TEST";
using (MD5 md5 = MD5.Create())
{
string playerGroup;
byte[] inputBytes = Encoding.UTF8.GetBytes(profileId);
byte[] hashBytes = md5.ComputeHash(inputBytes);

long hashCode = BitConverter.ToInt64(hashBytes, 0);
Console.WriteLine(hashCode);
}
}
}
Результат: -1956981089572930813
Я хочу воспроизвести тот же процесс в SQL (Amazone Redshift).
Но получаю другой результат.
Если да:

Код: Выделить всё

select from_hex(substring(md5('TEST'), 1, 16))::bigint
Результат: 233018722177570788
Есть ли способ воспроизвести процесс C# на SQL (Redshift)?
Я пробовал:

Код: Выделить всё

select from_hex(substring(md5('TEST'), 1, 16))::bigint
Я ожидал: -1956981089572930813
Получаю: 233018722177570788

Подробнее здесь: https://stackoverflow.com/questions/791 ... n-redshift

Вернуться в «C#»