示例#1
0
文件: test.py 项目: fason/stigmergy
import hec

n = 42698584543886360061486842200382003313624169085301946559663494615494833625919
g = 913326067085406944159077752059680922182858227942518126068162286667180140466107648842572565613813229372396932441628644186755601564075513741425077638718840
l = 21349292271943180030743421100191001656603342573794468515864801413886865646400
u = 17288039927630418853048986923739837980030231648803406440389082766106280079017

hec.init (str(n), str(g))

v = hec.new()
print v

for i in range(123):
	v = hec.inc (v, 1)

for i in range(56):
	v = hec.inc (v, 0)

hec.quit()

count = hec.get (v, str(n), str(l), str(u))
print count

示例#2
0
"""
Initialize module 'user'

=======================================================================

Authors:
    Yamashi (2012) >Y<

This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or (at
your option) any later version.

This program is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program.  If not, see <http://www.gnu.org/licenses/>.
"""

import hec

from django.conf import settings

#### Initiate encryption module when the webapp starts
hec.init(str(settings.CRYPTO_KEY_HOM_N), str(settings.CRYPTO_KEY_HOM_G))