Skip to content

Instantly share code, notes, and snippets.

@islamgulov
islamgulov / gist:2955511
Created June 19, 2012 17:45
list providers init
class BaseServiceHandler(BaseHandler):
"""
To use this class inherit from it and define _DRIVERS and _Providers
Also to encode to json response custom object add them to obj_attrs dict.
"""
_DRIVERS = None
_Providers = None
_providers_list_response = None
def _get_driver_instance(self):
#!/usr/bin/env python
# -*- coding:utf-8 -*-
import math
import numpy
def sigmoid(x):
"""вроде как лучше чем 1/(1+e^-x)"""
return math.tanh(x)
# -*- coding:utf-8 -*-
class GostCrypt(object):
def __init__(self, key, sbox):
assert self._bit_length(key) <= 256
self._key = None
self._subkeys = None
self.key = key
self.sbox = sbox
@islamgulov
islamgulov / gist:1953203
Created March 1, 2012 21:01
ГОСТ 28147-89
# -*- coding:utf-8 -*-
import sys
import numpy.random
import itertools
class GostCrypt(object):
def __init__(self, key, sbox):
assert self._bit_length(key) <= 256
self._key = None