コード例 #1
0
ファイル: _bits.py プロジェクト: 4lextg/kabopan
 def getdata(self):
     """builds an output string of what's currently compressed:
     currently output bit + current tag content"""
     tagstr = _misc.int2lebin(self.__tag, self.__tagsize)
     return _misc.modifystring(self.out, tagstr, self.__tagoffset)
コード例 #2
0
ファイル: _bits.py プロジェクト: stroykova/search
 def getdata(self):
     """builds an output string of what's currently compressed:
     currently output bit + current tag content"""
     tagstr = _misc.int2lebin(self.__tag, self.__tagsize)
     return _misc.modifystring(self.out, tagstr, self.__tagoffset)
コード例 #3
0
ファイル: _misc_test.py プロジェクト: 4lextg/kabopan
assert getvaluefrombinarystring("1000") == 8
assert getvaluefrombinarystring("001000") == 8

assert getpadbinstr(8, 8) == "00001000"

assert getunkbinstr(0, 0, 8) == "000000000"
assert getunkbinstr(1, 0, 8) == "000000001"
assert getunkbinstr(2, 1, 8) == "00000001x"
assert getunkbinstr(237, 3, 8) == "011101xxx"

assert gethexstr("\x00") == "00"
assert gethexstr("\x00\x01") == "00 01"
assert gethexstr("abcd") == "61 62 63 64"

assert int2lebin(1, 2) == '\x01\x00'
assert int2lebin(65535, 2) == "\xff\xff"
assert int2lebin(65535, 3) == "\xff\xff\x00"

assert int2bebin(1, 2) == '\x00\x01'

assert md5("") == "d41d8cd98f00b204e9800998ecf8427e"

assert modifystring("abcd", "_", 2) == "ab_d"
assert modifystring("abcde", "=+", 2) == "ab=+e"

assert getlongestcommon("31415926535", "31416")  == 4

assert rol(0x12345678, 8, 32) == 0x34567812
assert rol(0x1234567800, 8, 32) == 0x56780034 # entry value is masked first
assert rol(0x12345678, 8, 64) == 0x1234567800
コード例 #4
0
assert getvaluefrombinarystring("1000") == 8
assert getvaluefrombinarystring("001000") == 8

assert getpadbinstr(8, 8) == "00001000"

assert getunkbinstr(0, 0, 8) == "000000000"
assert getunkbinstr(1, 0, 8) == "000000001"
assert getunkbinstr(2, 1, 8) == "00000001x"
assert getunkbinstr(237, 3, 8) == "011101xxx"

assert gethexstr("\x00") == "00"
assert gethexstr("\x00\x01") == "00 01"
assert gethexstr("abcd") == "61 62 63 64"

assert int2lebin(1, 2) == '\x01\x00'
assert int2lebin(65535, 2) == "\xff\xff"
assert int2lebin(65535, 3) == "\xff\xff\x00"

assert int2bebin(1, 2) == '\x00\x01'

assert md5("") == "d41d8cd98f00b204e9800998ecf8427e"

assert modifystring("abcd", "_", 2) == "ab_d"
assert modifystring("abcde", "=+", 2) == "ab=+e"

assert getlongestcommon("31415926535", "31416") == 4

assert rol(0x12345678, 8, 32) == 0x34567812
assert rol(0x1234567800, 8, 32) == 0x56780034  # entry value is masked first
assert rol(0x12345678, 8, 64) == 0x1234567800