Dear colleagues.

Just executed the latest UTF-8 example for my curiosity:  

jython hashtest.py
String: my name is grinder
Unicode: array('b', [85, 45, -46, 48, 119, -14, 30, -97, 31, 97, -58, 83, -96, -115, 126, -16])

source:
# Jython user group report
# unicode via c language produces:
# [0] 85
# [1] 45
# [2] 210
# [3] 48
# [4] 119
# [5] 242
# [6] 30
# [7] 159
# [8] 31
# [9] 97
# [10] 198
# [11] 83
# [12] 160
# [13] 141
# [14] 126
# [15] 240
import hashlib
from array import array as pyArray
from jarray import array
input = "my name is grinder"
m=hashlib.md5()
data1 = pyArray('B',input)
trial = unicode(data1).encode("utf-8")
m.update(trial)
data3 = array(m.digest(),'b')
print "String: " + input
print "Unicode: "+ str(data3)


What are those -___ characters in the printout, how to read them correctly?  

Regards,
Claude


Claude Falbriard
Certified IT Specialist L2 - Middleware
AMS Hortolândia / SP - Brazil
phone:    +55 19 9837 0789
cell:         +55 13 8117 3316
e-mail:    claudef@br.ibm.com



From:        Rémi Rampin <remirampin@gmail.com>
To:        vijetha kulal <vijetha1188@gmail.com>,
Cc:        jython-users@lists.sourceforge.net
Date:        23/01/2013 12:51
Subject:        Re: [Jython-users] Output of MD5 encryption code in c# and Jython        are different




2013/1/23 vijetha kulal:
> [...]
> Jython code:
>
> input = "my name is grinder"
> m=hashlib.md5()
> data1 = array.array('B',input)
> unicode(data1)

This will not do what you want. You probably want to do something like
unicode(data1.tostring())

>> input = "my name is grinder"
>> m=hashlib.md5()
>> data1 = array.array('B',input)
>> trial = unicode(data1.tostring()).encode("utf-8")
>> m.update(trial)
>> data3 = jarray.array(m.digest(),'b')

------------------------------------------------------------------------------
Master Visual Studio, SharePoint, SQL, ASP.NET, C# 2012, HTML5, CSS,
MVC, Windows 8 Apps, JavaScript and much more. Keep your skills current
with LearnDevNow - 3,200 step-by-step video tutorials by Microsoft
MVPs and experts. ON SALE this month only -- learn more at:
http://p.sf.net/sfu/learnnow-d2d
_______________________________________________
Jython-users mailing list
Jython-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jython-users