差分

このページの2つのバージョン間の差分を表示します。

この比較画面にリンクする

両方とも前のリビジョン 前のリビジョン
次のリビジョン
前のリビジョン
次のリビジョン 両方とも次のリビジョン
crypt:xor [2012/02/18 04:22]
kikuzou
crypt:xor [2012/02/18 10:37]
kikuzou
行 2: 行 2:
  
 ====== XOR ====== ====== XOR ======
 +  * 排他的論理和(XOR)を使用した暗号
  
 ===== xortools ===== ===== xortools =====
行 15: 行 16:
 out_buf.write(single_byte_xor(in_buf, 0xBC)) out_buf.write(single_byte_xor(in_buf, 0xBC))
 out_buf.close() out_buf.close()
 +</code>
 +
 +=== Sample Script ===
 +    * 指定したファイルを key 0-255 でXOR (256個のファイルを作成) ((素人が作成したので、もっときれいにして下さいw))
 +
 +<code python xor-single.py>
 +#!/usr/bin/python
 +# -*- coding: UTF-8 -*-
 +
 +import sys
 +from xortools import single_byte_xor
 +
 +if len(sys.argv) == 1:
 +  print "usage: " + __file__ + " filename"
 +  sys.exit()
 +
 +key = 0
 +argvs = sys.argv
 +
 +in_buf = open(argvs[1], 'rb').read()
 +
 +while key < 256:
 +        hkey = hex(key)
 +        output = str(argvs[1]) + '.' + str(hkey) + '.xor'
 +        out_buf = open(output, 'wb')
 +        out_buf.write(single_byte_xor(in_buf, key))
 +        out_buf.close()
 +        key += 1
 </code> </code>
  
crypt/xor.txt · 最終更新: 2014/05/07 02:32 by kikuzou
 
特に明示されていない限り、本Wikiの内容は次のライセンスに従います: CC Attribution-Share Alike 4.0 International
Recent changes RSS feed Donate Powered by PHP Valid XHTML 1.0 Valid CSS Driven by DokuWiki