Перевод кода из java на c#
Формулировка задачи:
Доброго времени суток, не могли ли вы мне помочь с переводом кода на c# ?
вот собственно сам код :
Заранее спасибо
time /= 30;
byte[] timeBytes = new byte[8];
int i = 8;
while (true) {
int i2 = i - 1;
if (i <= 0) {
break;
}
timeBytes[i2] = (byte) ((int) time);
time >>>= 8;
i = i2;
}
SecretKeySpec signKey = new SecretKeySpec(this.mSecret, "HmacSHA1");
try {
Mac mac = Mac.getInstance("HmacSHA1");
mac.init(signKey);
byte[] hmac_result = mac.doFinal(timeBytes);
int offset = hmac_result[19] & 15;
int bin_code = ((((hmac_result[offset] & 127) << 24) | ((hmac_result[offset + 1] & 255) << 16)) | ((hmac_result[offset + 2] & 255) << 8)) | (hmac_result[offset + 3] & 255);
byte[] resultBytes = new byte[5];
for (i2 = 0; i2 < 5; i2++) {
resultBytes[i2] = s_rg[bin_code % s_rg.length];
bin_code /= s_rg.length;
}Решение задачи: «Перевод кода из java на c#»
textual
Листинг программы
using javax.crypto.Mac; using javax.crypto.spec.SecretKeySpec;