Teach how to hash data in mql4
Yeah, they're looking for younger people now.
Comrade citizen programmers teach me how to hash the data on mql4 (I seem to know how to use base64)
MD5 is needed ?
MD5 I think I found an example somewhere.
sha256
I haven't dealt with it so for the most part I don't even know what's needed - here's a code example on the sprp:
protected string Login= "Получить на странице доступа к API";
protected string Password = ""Получить на странице доступа к API";
protected string Culture ="ru-RU";
var RequestBalance = new { Login = Login, Wmid = wmid, Culture = Culture, Signature = HashToBase64(String.Format("{0};{1};{2};{3}", Login, Password, Culture, wmid), null)};
string Response = ITServiceJson.Balance(ForceJson(RequestBalance));
static public byte[] Hash(string plainString, Encoding encoding)
{
if (plainString == null)
throw new ArgumentNullException("plainString");
if (encoding == null)
encoding = Encoding.UTF8;
return Hash(encoding.GetBytes(plainString));
}
static public byte[] Hash(byte[] bytes)
{
if (bytes == null)
throw new ArgumentNullException("bytes");
using (SHA256 algorithm = new SHA256Managed())
{
byte[] hashBytes = algorithm.ComputeHash(bytes);
return hashBytes;
}
}
public string HashToBase64(string plainString, Encoding encoding)
{
if (plainString == null) throw new ArgumentNullException("plainString");
return Convert.ToBase64String(Hash(plainString, encoding));
}
I've figured out how to send a post request, but I need to make a hash here Signature:
| name | destination | note |
| Login | trader login | is given to the trader on the API access page and is used to sign requests to the online exchange. |
| Password | trader password | obtained by trader on the API access page and used to sign requests to the online-exchange |
| Wmid | Trader's Wmid | WM identifier of the trader, when working with the online-exchange |
| Culture | query language | Defines the message language. (ru-RU, en-EN) |
| Signature | request signature | generated from parameters: Login + ';' + Password + ';' + Culture + ';' +Wmid |
MD5 ?
- Offspark B.V.
- tls.mbed.org
I, being naive, wanted a ready-made one.
I was naive, I wanted a ready-made one.
ZS: maybe winds has some built-in libraries that do this encryption.
Sorry about the misspelling.
Write in Sharpe, Sanek, you don't have to think much there.
I'm already on my 4th exchange, I'm implementing the api :)
ZS: maybe Windows has some built-in libraries that do such encryption.
- msdn.microsoft.com