## Polynomial Basis Squaring

Finally have successfully found some spare time to do coding to solve this polynomial squaring:

And this is the result, x^5 + x + 1 :

• #### rudi 9:37 pm on May 30, 2013 Permalink | Reply

bu, akan lebih cantik kalo nulis polinomnya pake latex,
$x^5 + x+1$

• #### CG 11:00 am on May 31, 2013 Permalink | Reply

iya belum sempet dirapihin 😀 biasanya saya pake latex for wordpress

## Why Python?

Our research group is developing a library for finite field operations on very long bits, so we start gathering information about the performance of Python on scientific programming, big numbers especially for cryptography.
Here are some important links related to Python for scientific and cryptography implementation:

1. http://www.tutorialspoint.com/python/python_numbers.htm – about Python number representations
2. https://pypi.python.org/pypi/PyECC – a module for implementing Elliptic Curve Cryptography
3. http://theunixgeek.blogspot.com/2008/09/c-vs-python-speed.html – Python compared to C
4. http://www.linuxjournal.com/magazine/use-python-scientific-computing – the use of Python for scientific computing
5. http://scipy-lectures.github.com/ – Python Scientific Lecture Notes
6. http://www.scientificpython.net/ – Scientific Computing with Python
7. http://wiki.python.org/moin/NumericAndScientific – list of modules and tools for various implementation in Python
8. http://ubuntuforums.org/showthread.php?t=1581805 – Python power for large numbers
9. http://programmers.stackexchange.com/questions/128589/how-to-handle-large-numbers – handling big numbers with Python
10. http://www.daniweb.com/software-development/python/threads/364584/very-large-numbers – library for big numbers in Python
11. http://www.daniweb.com/software-development/python/threads/364584/very-large-numbers – Python can handle very big numbers
13. https://gist.github.com/bellbind/1414867 – Elliptic Curve Cryptography implementation in Python

• #### Tafta 5:08 pm on March 16, 2013 Permalink | Reply

The title doesn’t match the content, please dech (pake helm biar ga ditampar)

• #### CG 7:27 pm on March 16, 2013 Permalink | Reply

*tempiling sampe kepalanya lepas*

## Python: Converting String to Binary

A simple code on how to convert string to binary, accessing array string and performing shift operation on binary

``````
#!/usr/bin/python``````

a_str = ‘10110011’
b_str = “00101010”
a_bin = int(a_str, 2)
b_bin = int(b_str, 2)

print “a “, int(a_bin), a_str
print “b “, int(b_bin), b_str
print “a[0] “, a_str[0]
print “b[0:3]”, b_str[0:3]

#print “c “, c, bin(c)[2:]

print “a << 2 “, a_bin << 2, bin(a_bin << 2)[2:]
print “b >> 2 “, b_bin >> 2, bin(b_bin >> 2)[2:]

The result:

• #### tinykuya 3:02 pm on March 15, 2013 Permalink | Reply

ternyata dari string diconvert dulu ke int, terus diconvert lagi ke binary.. ya ya ya.. saya sempat berpikir operasi binernya dalam bentuk array 😀 kalau seperti ini, masuk akal.

terima kasih bu.

• #### CG 3:55 pm on March 15, 2013 Permalink | Reply

sip mudah2an berguna 😉

## Python: Bit Operations

Basic bit operations in Python:

``````
#!/usr/bin/python

a = 60            # 60 = 0011 1100
b = 13            # 13 = 0000 1101
c = 0

print "a = ", (bin(a)[2:]);
print "b = ", (bin(b)[2:]);

c = a & b;        # 12 = 0000 1100
print "a & b = ", (bin(c)[2:]);

c = a | b;        # 61 = 0011 1101
print "a | b = ", (bin(c)[2:]);

c = a ^ b;        # 49 = 0011 0001
print "a ^ b = ", (bin(c)[2:]);

c = ~a;           # -61 = 1100 0011
print "~a = ", (bin(c)[2:]);

c = a << 2;       # 240 = 1111 0000
print "a <> 2;       # 15 = 0000 1111
print "a >> 2 = ", (bin(c)[2:]);
``````

Result:

An interesting link about bit operation algorithm implementation in Python is here.

c
Compose new post
j
Next post/Next comment
k
Previous post/Previous comment
r