vb.net - Arithmetic operation resulted in an overflow—blowfish algorithm -


when execute code:

dim bytearray() byte = system.io.file.readallbytes("c:\users\fery ferdiansyah\desktop\asd\asd.txt") dim key() byte = system.text.encoding.utf8.getbytes("swagger") dim bf new blowfish2(key) 

this syntax y = s(0, a) + s(1, b) in function causes arithmetic overflow:

private function f(byval x uinteger) uinteger     dim ushort     dim b ushort     dim c ushort     dim d ushort     dim y uinteger      d = cushort((x , &hff))     x >>= 8     c = cushort((x , &hff))     x >>= 8     b = cushort((x , &hff))     x >>= 8     = cushort((x , &hff))     y = s(0, a) + s(1, b)     y = y xor s(2, c)     y = y + s(3, d)      return y end function 

could me fix function?

you can either disable integer overflow checking (advanced compiler settings dialog box (visual basic)) or declare y uint64 then

return cuint(y , &hffffffff) 

Comments

Popular posts from this blog

google api - Incomplete response from Gmail API threads.list -

Installing Android SQLite Asset Helper -

Qt Creator - Searching files with Locator including folder -