1919 xrange = range
2020
2121import math
22+ import warnings
2223
2324
2425class Error (Exception ):
@@ -326,8 +327,13 @@ def factorization(n):
326327 return result
327328
328329
329- def phi (n ):
330+ def phi (n ): # pragma: no cover
330331 """Return the Euler totient function of n."""
332+ # deprecated in 0.14
333+ warnings .warn ("Function is unused by library code. If you use this code, "
334+ "please open an issue in "
335+ "https://github.com/warner/python-ecdsa" ,
336+ DeprecationWarning )
331337
332338 assert isinstance (n , integer_types )
333339
@@ -345,20 +351,30 @@ def phi(n):
345351 return result
346352
347353
348- def carmichael (n ):
354+ def carmichael (n ): # pragma: no cover
349355 """Return Carmichael function of n.
350356
351357 Carmichael(n) is the smallest integer x such that
352358 m**x = 1 mod n for all m relatively prime to n.
353359 """
360+ # deprecated in 0.14
361+ warnings .warn ("Function is unused by library code. If you use this code, "
362+ "please open an issue in "
363+ "https://github.com/warner/python-ecdsa" ,
364+ DeprecationWarning )
354365
355366 return carmichael_of_factorized (factorization (n ))
356367
357368
358- def carmichael_of_factorized (f_list ):
369+ def carmichael_of_factorized (f_list ): # pragma: no cover
359370 """Return the Carmichael function of a number that is
360371 represented as a list of (prime,exponent) pairs.
361372 """
373+ # deprecated in 0.14
374+ warnings .warn ("Function is unused by library code. If you use this code, "
375+ "please open an issue in "
376+ "https://github.com/warner/python-ecdsa" ,
377+ DeprecationWarning )
362378
363379 if len (f_list ) < 1 :
364380 return 1
@@ -370,9 +386,14 @@ def carmichael_of_factorized(f_list):
370386 return result
371387
372388
373- def carmichael_of_ppower (pp ):
389+ def carmichael_of_ppower (pp ): # pragma: no cover
374390 """Carmichael function of the given power of the given prime.
375391 """
392+ # deprecated in 0.14
393+ warnings .warn ("Function is unused by library code. If you use this code, "
394+ "please open an issue in "
395+ "https://github.com/warner/python-ecdsa" ,
396+ DeprecationWarning )
376397
377398 p , a = pp
378399 if p == 2 and a > 2 :
@@ -381,9 +402,14 @@ def carmichael_of_ppower(pp):
381402 return (p - 1 ) * p ** (a - 1 )
382403
383404
384- def order_mod (x , m ):
405+ def order_mod (x , m ): # pragma: no cover
385406 """Return the order of x in the multiplicative group mod m.
386407 """
408+ # deprecated in 0.14
409+ warnings .warn ("Function is unused by library code. If you use this code, "
410+ "please open an issue in "
411+ "https://github.com/warner/python-ecdsa" ,
412+ DeprecationWarning )
387413
388414 # Warning: this implementation is not very clever, and will
389415 # take a long time if m is very large.
@@ -401,9 +427,14 @@ def order_mod(x, m):
401427 return result
402428
403429
404- def largest_factor_relatively_prime (a , b ):
430+ def largest_factor_relatively_prime (a , b ): # pragma: no cover
405431 """Return the largest factor of a relatively prime to b.
406432 """
433+ # deprecated in 0.14
434+ warnings .warn ("Function is unused by library code. If you use this code, "
435+ "please open an issue in "
436+ "https://github.com/warner/python-ecdsa" ,
437+ DeprecationWarning )
407438
408439 while 1 :
409440 d = gcd (a , b )
@@ -418,10 +449,15 @@ def largest_factor_relatively_prime(a, b):
418449 return a
419450
420451
421- def kinda_order_mod (x , m ):
452+ def kinda_order_mod (x , m ): # pragma: no cover
422453 """Return the order of x in the multiplicative group mod m',
423454 where m' is the largest factor of m relatively prime to x.
424455 """
456+ # deprecated in 0.14
457+ warnings .warn ("Function is unused by library code. If you use this code, "
458+ "please open an issue in "
459+ "https://github.com/warner/python-ecdsa" ,
460+ DeprecationWarning )
425461
426462 return order_mod (x , largest_factor_relatively_prime (m , x ))
427463
0 commit comments