게시판 즐겨찾기
편집
드래그 앤 드롭으로
즐겨찾기 아이콘 위치 수정이 가능합니다.
파이썬] RPython 문법에 관해 질문이 있습니다!
게시물ID : programmer_12265짧은주소 복사하기
작성자 : 점만은시키
추천 : 0
조회수 : 633회
댓글수 : 3개
등록시간 : 2015/07/22 11:18:08
옵션
  • 베스트금지
  • 본인삭제금지
속도 비교를 위해서 RSA 알고리즘을 이용한 암호화 및 복호화 하는 파이썬 코드를 짯는데,

이걸 RPython 문법으로 바꾸려니까 머리에 쥐가 나네요;

import os
import sys
import M2Crypto

def run(key_pair):
    LOOP = 5000
    for i in range(LOOP):
        msg = "crypting"
        print "Before :" + msg
        CipherText = key_pair.public_encrypt(msg, M2Crypto.RSA.pkcs1_oaep_padding)

        PlainText = key_pair.private_decrypt(CipherText, M2Crypto.RSA.pkcs1_oaep_padding)
        print "After :" + PlainText

    return 0

def entry_point(argv):
    gen_key = M2Crypto.RSA.gen_key(2048, 65537)
    run(gen_key)
    return 0

def target(*args):
    return entry_point, None

if __name__ == "__main__":
    M2Crypto.Rand.rand_seed(os.urandom(1024))
    entry_point(sys.argv)

이런식으로 작성 했는데,

[translation:ERROR] Exception: object with a __call__ is not RPython: <built-in function rsa_generate_key>
[translation:ERROR] Processing block:
[translation:ERROR]  block@18 is a <class 'rpython.flowspace.flowcontext.SpamBlock'>
[translation:ERROR]  in (M2Crypto.RSA:314)gen_key
[translation:ERROR]  containing the following operations:
[translation:ERROR]        v0 = simple_call((builtin_function_or_method rsa_generate_key), bits_0, e_0, callback_0)
[translation:ERROR]        v1 = simple_call((classobj RSA), v0, (1))
[translation:ERROR]  --end--

이런 에러가 나오면서 안되네요 ㅠㅠ RPython을 좀 아시는분은 도움부탁드립니다 ㅠㅠ
전체 추천리스트 보기
새로운 댓글이 없습니다.
새로운 댓글 확인하기
글쓰기
◀뒤로가기
PC버전
맨위로▲
공지 운영 자료창고 청소년보호