unpack

Lua unpack bug?

强颜欢笑 提交于 2019-12-18 05:47:10
问题 I Have stumbled on a weird behavior in Lua unpack function table1 = {true, nil, true, false, nil, true, nil} table2 = {true, false, nil, false, nil, true, nil} a1,b1,c1,d1,e1,f1,g1 = unpack( table1 ) print ("table1:",a1,b1,c1,d1,e1,f1,g1) a2,b2,c2,d2,e2,f2,g2 = unpack( table2 ) print ("table2:",a2,b2,c2,d2,e2,f2,g2) Output: table1: true nil true false nil nil nil table2: true false nil nil nil nil nil The second unpack delivers parameters up to the first nil value. I could live with that. The

git unpack error on push to gerrit

筅森魡賤 提交于 2019-12-17 17:26:02
问题 On push of a new branch to a gerrit server we encounter the following error: de@roma:~/git-hate/www$ git push origin landingpage Counting objects: 149, done. Delta compression using up to 2 threads. Compressing objects: 100% (73/73), done. Writing objects: 100% (111/111), 2.77 MiB, done. Total 111 (delta 68), reused 80 (delta 38) remote: Resolving deltas: 100% (68/68) error: unpack failed: error Missing tree 30c4809ade0b4b0c81cb7f882450774862b82361 fatal: Unpack error, check server log To ssh

Unpack format characters in Python

自闭症网瘾萝莉.ら 提交于 2019-12-14 03:46:57
问题 I need the Python analog for this Perl string: unpack("nNccH*", string_val) I need the nNccH* - data format in Python format characters. In Perl it unpack binary data to five variables: 16 bit value in "network" (big-endian) 32 bit value in "network" (big-endian) Signed char (8-bit integer) value Signed char (8-bit integer) value Hexadecimal string, high nibble first But I can't do it in Python More: bstring = '' while DataByte = client[0].recv(1): bstring += DataByte print len(bstring) if

Retrieve IV from RNCryptor AES 256 header in PHP

荒凉一梦 提交于 2019-12-14 01:28:47
问题 Using the latest source of RNCryptor and attempting to send the encrypted data to a PHP script. RNCryptor packages the IV into the header section which is prepended onto the actual encrypted data. - (NSData *)header { uint8_t header[2] = {kRNCryptorFileVersion, self.options}; NSMutableData *headerData = [NSMutableData dataWithBytes:header length:sizeof(header)]; if (self.options & kRNCryptorOptionHasPassword) { [headerData appendData:self.encryptionSalt]; // 8 bytes [headerData appendData

Packing data of different sizes into a list of unsigned ints

笑着哭i 提交于 2019-12-14 00:40:47
问题 I have a set of data that represents a hardware structure that I need to manipulate in python. The real structure is 4 KB in size...I'll just whip up a quick example: Byte(s) Value 0-1 0x0102 2-3 0x0304 4-23 "AStrWith20Characters" 24-63 "WoahThisStringHas40CharactersItIsHuge!!!" 64-71 "Only8Chr" 72-74 0x050607 74 0x08 75-127 0x00 (padding) The idea is I pack this structure up into a list of 32 bit Ints, pass the list off to another function, and that function then writes the whole shebang out

PHP Warning: unpack(): Type n: not enough input - log entry

有些话、适合烂在心里 提交于 2019-12-13 17:09:03
问题 So I have found this error log PHP Warning: unpack(): Type n: not enough input, need 2, have 0 in {{file}}{{line}} the said file and line contains this code: $answerHeader = unpack('ntype/nclass/Nttl/nlength', $answerHeaderBin); This is part of a code which makes a query on a DNS. My issue is that I don;t know how to debug this. If I try to dump the before mentioned header the information is correct. I tried unpack() with no arguments and it just returns false with no errors. So I guess, my

ValueError: too many values to unpack (Python 2.7)

最后都变了- 提交于 2019-12-13 09:55:57
问题 values = data.split("\x00") username, passwordHash, startRoom, originUrl, bs64encode = values if len(passwordHash)!= 0 and len(passwordHash)!= 64: passwordHash = "" if passwordHash != "": passwordHash = hashlib.sha512(passwordHash).hexdigest() username = username.replace("<", "") if len(startRoom) > 200: startRoom = "" startRoom = self.roomNameStrip(startRoom, "2").replace("<","").replace("&#", "&amp;#") self.login(username, passwordHash, startRoom, originUrl) Error: username, passwordHash,

Python ValueError : too many values to unpack, solution?

北战南征 提交于 2019-12-13 08:16:34
问题 Im getting this error and i have no idea what it means, i can get the program to print the files from there values but its just a long incoherent now im trying to get it to print it in an organized manor and thats where the issues arise. import os def listfiles (path): files = [] for dirName, subdirList, fileList in os.walk(path): dir = dirName.replace(path, '') for fname in fileList: files.append(os.path.join(dir, fname)) return files a = input('Enter a primary file path: ') b = input('Enter

Unpack in a SSB

狂风中的少年 提交于 2019-12-13 07:57:19
问题 I use part of a SSB as a matrix 3D of linked lists. Each voxel of the matric is a uint that gives the location of the first element of the list. Before each rendering, I need to re-init this matrix, but not the whole SSB. So I associated the part corresponding to the matrix with a texture 1D to be able to unpack a buffer inside it. //Storage Shader buffer glGenBuffers(1, &m_buffer); glBindBufferBase(GL_SHADER_STORAGE_BUFFER, 0, m_buffer); glBufferData(GL_SHADER_STORAGE_BUFFER,

Can I use Perl's unpack to break up a string into vars?

一笑奈何 提交于 2019-12-12 14:29:45
问题 I have an image file name that consists of four parts: $Directory (the directory where the image exists) $Name (for a art site, this is the paintings name reference #) $File (the images file name minus extension) $Extension (the images extension) $example 100020003000.png Which I desire to be broken down accordingly: $dir=1000 $name=2000 $file=3000 $ext=.png I was wondering if substr was the best option in breaking up the incoming $example so I can do stuff with the 4 variables like