404neko
V2EX  ›  问与答

[密码学]拿到一串长长的 16 进制串 应该如何处理

  •  
  •   404neko · Aug 23, 2014 · 3943 views
    This topic created in 4305 days ago, the information mentioned may be changed or developed.
    7 replies    2014-08-26 18:06:59 +08:00
    wormcy
        1
    wormcy  
       Aug 24, 2014 via Android   ❤️ 1
    坐等大神 我一般直接扔撞库网站
    404neko
        2
    404neko  
    OP
       Aug 24, 2014
    @wormcy 密码学!=密码
    seffyvon
        3
    seffyvon  
       Aug 25, 2014
    以Python为例子:

    1. 如果是16进制字符串,可以将每两个字符转化成对应的十六进制数
    比如c="32510ba9babebbbe"
    就可以把"32" "51" "0b" 这些使用int("32",16)转成对应的int类型,可以做各种xor运算,对于cipher text、plain text来处理,或者当作密钥

    2. 如果是16进制数,直接当成long类型来处理就可以了,比如Python中的Crypto,是密码学上很好用的模块:
    from Crypto.PublicKey.RSA import construct
    rsa_obj = construct(N, e, d) #N, e, d都是long类型
    a = rsa_obj.decrypt(cipherText) #cipherText也是long类型
    404neko
        4
    404neko  
    OP
       Aug 25, 2014
    @seffyvon 有密码学的书籍推荐么
    seffyvon
        5
    seffyvon  
       Aug 25, 2014
    @404neko 我没有刷过书,只是假期有空上了一下Coursera的课程Cryptography I :) 九月还有II
    seffyvon
        6
    seffyvon  
       Aug 25, 2014
    不过你是对密码学感兴趣嘛?
    404neko
        7
    404neko  
    OP
       Aug 26, 2014
    @seffyvon 感谢
    是...
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   2764 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 32ms · UTC 11:37 · PVG 19:37 · LAX 04:37 · JFK 07:37
    ♥ Do have faith in what you're doing.