Deprecated: The behavior of unparenthesized expressions containing both '.' and '+'/'-' will change in PHP 8: '+'/'-' will take a higher precedence in /home/iano/public_html/tpforums-vb5/forum/includes/class_core.php on line 5842

PHP Warning: Use of undefined constant MYSQL_NUM - assumed 'MYSQL_NUM' (this will throw an Error in a future version of PHP) in ..../includes/init.php on line 165

PHP Warning: Use of undefined constant MYSQL_ASSOC - assumed 'MYSQL_ASSOC' (this will throw an Error in a future version of PHP) in ..../includes/init.php on line 165

PHP Warning: Use of undefined constant MYSQL_BOTH - assumed 'MYSQL_BOTH' (this will throw an Error in a future version of PHP) in ..../includes/init.php on line 165

PHP Warning: "continue" targeting switch is equivalent to "break". Did you mean to use "continue 2"? in ..../includes/functions_navigation.php on line 588

PHP Warning: "continue" targeting switch is equivalent to "break". Did you mean to use "continue 2"? in ..../includes/functions_navigation.php on line 612

PHP Warning: Use of undefined constant misc - assumed 'misc' (this will throw an Error in a future version of PHP) in ..../global.php(29) : eval()'d code(6) : eval()'d code on line 1

PHP Warning: Use of undefined constant index - assumed 'index' (this will throw an Error in a future version of PHP) in ..../global.php(29) : eval()'d code(6) : eval()'d code on line 1

PHP Warning: Use of undefined constant misc - assumed 'misc' (this will throw an Error in a future version of PHP) in ..../includes/class_bootstrap.php(1422) : eval()'d code(4) : eval()'d code on line 1

PHP Warning: Use of undefined constant index - assumed 'index' (this will throw an Error in a future version of PHP) in ..../includes/class_bootstrap.php(1422) : eval()'d code(4) : eval()'d code on line 1

PHP Warning: Use of undefined constant onlinestatusphrase - assumed 'onlinestatusphrase' (this will throw an Error in a future version of PHP) in ..../includes/class_core.php(4684) : eval()'d code on line 6

PHP Warning: Use of undefined constant onlinestatusphrase - assumed 'onlinestatusphrase' (this will throw an Error in a future version of PHP) in ..../includes/class_core.php(4684) : eval()'d code on line 6

PHP Warning: Use of undefined constant onlinestatusphrase - assumed 'onlinestatusphrase' (this will throw an Error in a future version of PHP) in ..../includes/class_core.php(4684) : eval()'d code on line 6

PHP Warning: Use of undefined constant onlinestatusphrase - assumed 'onlinestatusphrase' (this will throw an Error in a future version of PHP) in ..../includes/class_core.php(4684) : eval()'d code on line 6

PHP Warning: Use of undefined constant onlinestatusphrase - assumed 'onlinestatusphrase' (this will throw an Error in a future version of PHP) in ..../includes/class_core.php(4684) : eval()'d code on line 6

PHP Warning: Use of undefined constant onlinestatusphrase - assumed 'onlinestatusphrase' (this will throw an Error in a future version of PHP) in ..../includes/class_core.php(4684) : eval()'d code on line 6

PHP Warning: Use of undefined constant onlinestatusphrase - assumed 'onlinestatusphrase' (this will throw an Error in a future version of PHP) in ..../includes/class_core.php(4684) : eval()'d code on line 6

PHP Warning: Use of undefined constant onlinestatusphrase - assumed 'onlinestatusphrase' (this will throw an Error in a future version of PHP) in ..../includes/class_core.php(4684) : eval()'d code on line 6

PHP Warning: Use of undefined constant onlinestatusphrase - assumed 'onlinestatusphrase' (this will throw an Error in a future version of PHP) in ..../includes/class_core.php(4684) : eval()'d code on line 85

PHP Warning: Use of undefined constant onlinestatusphrase - assumed 'onlinestatusphrase' (this will throw an Error in a future version of PHP) in ..../includes/class_core.php(4684) : eval()'d code on line 6

PHP Warning: Use of undefined constant onlinestatusphrase - assumed 'onlinestatusphrase' (this will throw an Error in a future version of PHP) in ..../includes/class_core.php(4684) : eval()'d code on line 6
rsa encryption
Results 1 to 10 of 10

Thread: rsa encryption

  1. #1

    rsa encryption

    can someone post algorithm wich will encrypt data with rsa?
    please.

  2. #2
    Junior Member
    Join Date
    Sep 2007
    Posts
    28

    rsa encryption

    It's not really an algoritm, its math:

    Encryption:
    c = m ^e (mod n)

    Decryption
    m = c ^e (mod n)

    Where c is the encrypted message and m is the message.
    For the exponent tibia uses 65537.
    n is the private / public key.

    Tibias public key is 12471045942682794300437644989798558216780170796069 70371640449048629485693808504213969045976869538770 22394604239428185498284169068581802277612081027966 72433631944853781144171907648434092285492927351730 86613707271053828991189994038080458464446472844991 23164879035103627004668521005328367415259939915284 902061793

    It might also be handy to use OT keys if you're doing a proxy or something
    OT public key is
    10912013296739942927886096050899554152823750290279 81291234687579372662914925764463307396960011106039 07230888610072655818825358503429057592827629436413 10856602909362821263595383668656267584972062078627 94310902180176810615217550567108238764764442605581 47179707119674283982419152118103759076030616683978 566631413
    OT private key is
    46730330223584118622160180015036832148732986808519 34467521055526294025873980576686022461064691960586 02063280243267033616301098884178392419595075722472 84807035235569619173792292786907845791904955103601 65282251912190836718788550927002538864170082173534 52220879405783812108791168230137768089757668518290 20659073

    Hope this helps

  3. #3
    Senior Member
    Join Date
    Apr 2008
    Posts
    689

    rsa encryption

    you will need a library(like GMP) or write your own "class" for big integers and you can see how it is done checking ot's sources

  4. #4

    rsa encryption

    does it work in-place mode?
    of after multiplying it 65k times i have to save all used memory? or just as much bytes as i used for calculation? i belive it is in-place, bacause client send < 200 bytes, not < 200 tera bytes.


    and plz next time write those keys in hex

  5. #5
    Senior Member
    Join Date
    Mar 2007
    Posts
    1,323

    rsa encryption

    Why the keys must be in hex?

  6. #6

    rsa encryption

    because its easier (WAY EASIER) to fill memory with hex values than non-hex.
    i have to convert this to hex, and then fil memory from wich i will read them to make div. in hex you know that 2 characters = 1 byte, in this you dont.

  7. #7

    rsa encryption

    what is wrong in this code? why it doesnt work?

    Code:
    def modexp ( t, u, n ):
       s = 1
       while u:
        	if u & 1:
        	   s = (s * t)%n
        	u >>= 1
        	t = (t * t)%n;
       return s
       
       
       
       
    a = 0x124
       
       
    a = modexp(a, 65537, 109120132967399429278860960508995541528237502902798129123468757937266291492576446330739696001110603907230888610072655818825358503429057592827629436413108566029093628212635953836686562675849720620786279431090218017681061521755056710823876476444260558147179707119674283982419152118103759076030616683978566631413);
    a = modexp(a, 65537, 46730330223584118622160180015036832148732986808519344675210555262940258739805766860224610646919605860206328024326703361630109888417839241959507572247284807035235569619173792292786907845791904955103601652822519121908367187885509270025388641700821735345222087940578381210879116823013776808975766851829020659073);
    
    
    
    print(hex(a));

  8. #8

    rsa encryption

    Can python handle an integer that big without using special classes?

  9. #9

    rsa encryption

    Certainly Python can handle such integers. But why reimplement the wheel when modular exponentiation is built in (as the pow() function)?

    Nevertheless, this version of modexp looks sensible. Looks like you're trying to test it by encrypting and decrypting 0x124, but I think you used the wrong decryption key.

    Edit: I meant that 46730... is the private exponent; the modulus remains the same as for encryption. Try
    a = modexp(a, 65537, 10912[snip]31413);
    a = modexp(a, 46730[snip]59073, 10912[snip]31413);

  10. #10

    rsa encryption

    http://cisnet.baruch.cuny.edu/holowc.../9444/rsademo/

    key is ok, works here.

    Code:
    def modexp ( t, u, n ):
       s = 1
       while u:
        	if u & 1:
        	   s = (s * t)%n
        	u >>= 1
        	t = (t * t)%n;
       return s
       
       
       
       
    a = 0x61616161616161616161
       
       
    a = modexp(a, 65537, 109120132967399429278860960508995541528237502902798129123468757937266291492576446330739696001110603907230888610072655818825358503429057592827629436413108566029093628212635953836686562675849720620786279431090218017681061521755056710823876476444260558147179707119674283982419152118103759076030616683978566631413);
    a = modexp(a, 65537, 46730330223584118622160180015036832148732986808519344675210555262940258739805766860224610646919605860206328024326703361630109888417839241959507572247284807035235569619173792292786907845791904955103601652822519121908367187885509270025388641700821735345222087940578381210879116823013776808975766851829020659073);
    
    
    
    print(hex(a));
    modex implementation is i belive also fine, so where is the problem?
    i tried everything, or maybe it works and i dont know how to read result? But i think i should get 0x61616161... at the ent. Rest nulls.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •