Changeset 322 for trunk

Show
Ignore:
Timestamp:
06/01/09 20:52:46 (3 years ago)
Author:
ocjhb
Message:

strenthening the random numbers; ordering coins for inspection; changing wording

Location:
trunk/sandbox/jhb
Files:
3 modified

Legend:

Unmodified
Added
Removed
  • trunk/sandbox/jhb/mobile/ocwallet.py

    r321 r322  
    1818        self.wallet.feedback = self.feedback 
    1919        self.displayWalletMenu()         
    20         self.actions=[(u'Send',u'Send coins to someone',icons['right'],self.spendCoins), 
    21                       (u'Receive',u'Receive coins',icons['left'],self.receiveCoins), 
    22                       (u'Freshen up',u'Freshen up the coins',icons['refresh'],self.freshenUp), 
    23                       (u'Mint',u'new coins from issuer',icons['down'],self.mintCoins), 
    24                       (u'Redeem',u'redeem from issuer',icons['up'],self.redeemCoins), 
     20        self.actions=[(u'Pay',u'Send coins',icons['right'],self.spendCoins), 
     21                      (u'Receive',u'receive coins',icons['left'],self.receiveCoins), 
     22                      (u'Get change',u'Optimize change',icons['refresh'],self.freshenUp), 
     23                      (u'Widthdraw',u'Get from issuer',icons['down'],self.mintCoins), 
     24                      (u'Exchange',u'Send coins back ',icons['up'],self.redeemCoins), 
    2525                      (u'Details',u'See what coins you hold',icons['coins'],self.inspectCurrency),] 
    2626 
     
    447447            import socket 
    448448            if sys.platform == 'symbian_s60': 
    449                 self.feedback(u'Preparing internet access:searching access points') 
     449                self.feedback(u'Prepare internet:search access') 
    450450                aps = [ap['name'] for ap in socket.access_points()] 
    451451                aps.sort() 
    452                 apid = appuifw.popup_menu(aps,u'select access point') 
     452                apid = appuifw.popup_menu(aps,u'select access') 
    453453                if apid == None: 
    454454                    return None 
    455                 self.feedback(u'Preparing internet access:setting access point') 
     455                self.feedback(u'Prepare interne:set access') 
    456456 
    457457                socket.set_default_access_point(aps[apid]) 
  • trunk/sandbox/jhb/oc2/rsa.py

    r272 r322  
    11"""RSA module 
    22 
    3 !!! This is just a playground, for understanding some bits and pieces, 
    4 this is not at all serious crypto production code!!! 
    5  
    6  
    7  
    8 Module for calculating large primes, and RSA encryption, decryption, 
    9 signing and verification. Includes generating public and private keys. 
     3This is a module based on the works by Sybren Stuvel, Marloes de Boer and Ivo Tamboer, 
     4tlslite, helped by Nils Toedtmann, done wrong by Joerg Baach ;-) 
     5 
     6This file still needs serious audit before you can trust it for anything productive 
     7 
    108""" 
    11  
    12 __author__ = "Sybren Stuvel, Marloes de Boer and Ivo Tamboer" 
    13 __date__ = "2004-11-17" 
    149 
    1510# NOTE: Python's modulo can return negative numbers. We compensate for 
     
    2015import random    # For picking semi-random numbers 
    2116import types 
     17from hashlib import sha256 
    2218 
    2319# Get os.urandom PRNG 
    2420import os 
    2521def getRandomBytes(howMany): 
    26     bits = howMany * 8 
     22    factor = 8 * 8 #bytesize time security factor 
     23    bits = howMany * factor 
     24    if bits % factor: 
     25        bits = bits+(16-(bits % factor)) 
    2726    number = random.getrandbits(bits) 
    28     return numberToBytes(number) 
     27    bytes =  numberToBytes(number) 
     28    out = '' 
     29 
     30    #Assuming we haven't used a good source of randomness, but the 
     31    #Mersenne twister, we hash a bit to make it secure 
     32    while bytes:         
     33        out += sha256(bytes[:factor]).digest() 
     34        bytes = bytes[factor:] 
     35    return stringToBytes(out[:howMany]) 
     36         
    2937   
    3038 
  • trunk/sandbox/jhb/oc2/wallet.py

    r320 r322  
    245245        secrets = [] 
    246246        data = [] 
     247        self.feedback('Talking to issuer: preparing blanks') 
    247248        for denomination in values: 
    248249            mkc = mkcs[str(denomination)] 
     
    271272    def getAllCoins(self,currencyId): 
    272273        currency = self.getCurrency(currencyId) 
    273         return currency['coins'] 
     274        tmp = [(int(c.denomination),c) for c in currency['coins']] 
     275        tmp.sort() 
     276        return [t[1] for t in tmp] 
    274277 
    275278