python에서 ROL, ROR 연산이 없어서 아래와 같이 만들어놨다.
def ROL(data, shift, size=32):
shift %= size
remains = data >> (size - shift)
body = (data << shift) - (remains << size )
return (body + remains)
def ROR(data, shift, size=32):
shift %= size
body = data >> shift
remains = (data << (size - shift)) - (body << size)
return (body + remains)
'Programming > Python' 카테고리의 다른 글
| python - Thread 사용 (1) | 2014.03.01 |
|---|---|
| python - dumpcode (0) | 2014.02.26 |
| RC4 알고리즘 - python (1) | 2013.12.14 |
| python HTML, XML 파싱 - BeautifulSoup (0) | 2013.11.21 |
| python SOCKS Proxy 사용 - socksipy (0) | 2013.11.08 |