Changeset 322
- Timestamp:
- 06/01/09 20:52:46 (3 years ago)
- Location:
- trunk/sandbox/jhb
- Files:
-
- 3 modified
-
mobile/ocwallet.py (modified) (2 diffs)
-
oc2/rsa.py (modified) (2 diffs)
-
oc2/wallet.py (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/sandbox/jhb/mobile/ocwallet.py
r321 r322 18 18 self.wallet.feedback = self.feedback 19 19 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 coinsfrom 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), 25 25 (u'Details',u'See what coins you hold',icons['coins'],self.inspectCurrency),] 26 26 … … 447 447 import socket 448 448 if sys.platform == 'symbian_s60': 449 self.feedback(u'Prepar ing internet access:searching access points')449 self.feedback(u'Prepare internet:search access') 450 450 aps = [ap['name'] for ap in socket.access_points()] 451 451 aps.sort() 452 apid = appuifw.popup_menu(aps,u'select access point')452 apid = appuifw.popup_menu(aps,u'select access') 453 453 if apid == None: 454 454 return None 455 self.feedback(u'Prepar ing internet access:setting access point')455 self.feedback(u'Prepare interne:set access') 456 456 457 457 socket.set_default_access_point(aps[apid]) -
trunk/sandbox/jhb/oc2/rsa.py
r272 r322 1 1 """RSA module 2 2 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. 3 This is a module based on the works by Sybren Stuvel, Marloes de Boer and Ivo Tamboer, 4 tlslite, helped by Nils Toedtmann, done wrong by Joerg Baach ;-) 5 6 This file still needs serious audit before you can trust it for anything productive 7 10 8 """ 11 12 __author__ = "Sybren Stuvel, Marloes de Boer and Ivo Tamboer"13 __date__ = "2004-11-17"14 9 15 10 # NOTE: Python's modulo can return negative numbers. We compensate for … … 20 15 import random # For picking semi-random numbers 21 16 import types 17 from hashlib import sha256 22 18 23 19 # Get os.urandom PRNG 24 20 import os 25 21 def 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)) 27 26 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 29 37 30 38 -
trunk/sandbox/jhb/oc2/wallet.py
r320 r322 245 245 secrets = [] 246 246 data = [] 247 self.feedback('Talking to issuer: preparing blanks') 247 248 for denomination in values: 248 249 mkc = mkcs[str(denomination)] … … 271 272 def getAllCoins(self,currencyId): 272 273 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] 274 277 275 278
