MCPcopy Create free account
hub / github.com/PierreGode/Ragnar / update

Method update

pager_lib/smb/utils/md4.py:78–172  ·  view source on GitHub ↗
(self, str)

Source from the content-addressed store, hash-verified

76
77 #-----------------------------------------------------
78 def update(self, str):
79 if isinstance(str, bytes):
80 buf = list(str)
81 else:
82 buf = [ord(i) for i in str]
83
84 ilen = U32(len(buf))
85
86 # check if the first length is out of range
87 # as the length is measured in bits then multiplay it by 8
88 if (int(self.len1 + (ilen << 3)) < int(self.len1)):
89 self.len2 = self.len2 + U32(1)
90
91 self.len1 = self.len1 + (ilen << 3)
92 self.len2 = self.len2 + (ilen >> 29)
93
94 L = U32(0)
95 bufpos = 0
96 while (int(ilen) > 0):
97 if (64 - int(self.count)) < int(ilen): L = U32(64 - int(self.count))
98 else: L = ilen
99 for i in range(int(L)): self.buf[i + int(self.count)] = buf[i + bufpos]
100 self.count = self.count + L
101 ilen = ilen - L
102 bufpos = bufpos + int(L)
103
104 if (int(self.count) == 64):
105 self.count = U32(0)
106 X = []
107 i = 0
108 for j in range(16):
109 X.append(U32(self.buf[i]) + (U32(self.buf[i+1]) << 8) + \
110 (U32(self.buf[i+2]) << 16) + (U32(self.buf[i+3]) << 24))
111 i = i + 4
112
113 A = self.A
114 B = self.B
115 C = self.C
116 D = self.D
117
118 A = f1(A,B,C,D, 0, 3, X)
119 D = f1(D,A,B,C, 1, 7, X)
120 C = f1(C,D,A,B, 2,11, X)
121 B = f1(B,C,D,A, 3,19, X)
122 A = f1(A,B,C,D, 4, 3, X)
123 D = f1(D,A,B,C, 5, 7, X)
124 C = f1(C,D,A,B, 6,11, X)
125 B = f1(B,C,D,A, 7,19, X)
126 A = f1(A,B,C,D, 8, 3, X)
127 D = f1(D,A,B,C, 9, 7, X)
128 C = f1(C,D,A,B,10,11, X)
129 B = f1(B,C,D,A,11,19, X)
130 A = f1(A,B,C,D,12, 3, X)
131 D = f1(D,A,B,C,13, 7, X)
132 C = f1(C,D,A,B,14,11, X)
133 B = f1(B,C,D,A,15,19, X)
134
135 A = f2(A,B,C,D, 0, 3, X)

Callers 9

readCBMethod · 0.45
sendWriteMethod · 0.45
_sendSMBMessage_SMB1Method · 0.45
findFirstCBMethod · 0.45
findNextCBMethod · 0.45
writeCBMethod · 0.45
digestMethod · 0.45

Calls 6

U32Class · 0.90
rangeFunction · 0.85
f1Function · 0.85
f2Function · 0.85
f3Function · 0.85
appendMethod · 0.80

Tested by

no test coverage detected