Перейти к содержимому
Калькуляторы

petrozawodsky

Новичок
  • Публикации

    1
  • Зарегистрирован

  • Посещение

О petrozawodsky

  • Звание
    Абитуриент
    Абитуриент

Посетители профиля

Блок посетителей профиля отключен и не будет отображаться другим пользователям

  1. function get_id(A0: tA0): DWord; const data_seq_a: array[0..11] of Byte = ( 0, 1, 2, 3, 4, 5, 6, 7, 16, 17, 18, 19); data_seq_b: array[0..11] of Byte = (15, 12, 9, 14, 11, 8, 13, 10, 22, 21, 20, 23); var in_buf: pByteArray; i: Integer; in_byte: Byte; data: array[0..23] of Byte; sum_a, buf_pos_a, bit_pos_a: Byte; sum_b, buf_pos_b, bit_pos_b: Byte; begin result:= $44042D73; in_buf:= @A0.Ext.Vendor_SN[0]; sum_a:= 0; for i:= 0 to 11 do begin in_byte:= (in_buf^[i*2] shl 4) or (in_buf^[i*2+1] and $0F); data[data_seq_a[i]]:= in_byte; data[data_seq_b[i]]:= in_byte; inc(sum_a, in_byte shl 1); end; sum_b:= sum_a; inc(sum_a, data[ data[ 1] mod 24] and $7F); inc(sum_b, data[16+(data[17] and $07)] and $7F); bit_pos_a:= sum_a and $07; bit_pos_b:= sum_b and $07; buf_pos_a:= sum_a and $0F; buf_pos_b:=(sum_b and $07) or $10; if bit_pos_a = 0 then buf_pos_a:= (buf_pos_a - 1) and $0F; if bit_pos_b = 0 then buf_pos_b:= (buf_pos_b - 1) and $07; bit_pos_a:= (bit_pos_a - 1) and $07; bit_pos_b:= (bit_pos_b - 1) and $07; for i:= 0 to 31 do begin if bit_pos_a = 0 then begin inc(buf_pos_a); if buf_pos_a > 15 then buf_pos_a:= 0; end; if bit_pos_b = 0 then begin inc(buf_pos_b); if buf_pos_b > 23 then buf_pos_b:= 16; end; result:= result xor ((((data[buf_pos_a]+buf_pos_a) shr bit_pos_a) and 1) shl i); result:= result xor ((((data[buf_pos_b]+buf_pos_b) shr bit_pos_b) and 1) shl i); bit_pos_a:= (bit_pos_a + 1) and $07; bit_pos_b:= (bit_pos_b + 1) and $07; end; result:= Swap32(result); end;