项目作者: Doerge

项目描述 :
pycrypto packaged for awslambda
高级语言: Python
项目地址: git://github.com/Doerge/awslambda-pycrypto.git
创建时间: 2015-12-01T13:07:48Z
项目社区:https://github.com/Doerge/awslambda-pycrypto

开源协议:

下载


awslambda-pycrypto

Python Cryptography Toolkit (pycrypto) compiled and packaged for AWS Lambda. Because that is a pain to do.

Setup

Simply download and include the Crypto folder in your project, zip and upload it to Lambda.

Lambda Example:

Directory structure:

  1. * myproject
  2. - Crypto/
  3. - lambda_handler.py

lambda_handler.py:

  1. from __future__ import print_function
  2. from Crypto.Hash import SHA256
  3. def lambda_handler(event, context):
  4. hash = SHA256.new()
  5. hash.update('message')
  6. digest = hash.digest()
  7. print(len(digest))
  8. print(repr(digest))
  9. return

Log output:

  1. START RequestId: 17e0f272-9b91-11e6-bf2d-f756ae83795f Version: $LATEST
  2. 32
  3. '\xabS\n\x13\xe4Y\x14\x98+y\xf9\xb7\xe3\xfb\xa9\x94\xcf\xd1\xf3\xfb"\xf7\x1c\xea\x1a\xfb\xf0+F\x0cm\x1d'
  4. END RequestId: 17e0f272-9b91-11e6-bf2d-f756ae83795f
  5. REPORT RequestId: 17e0f272-9b91-11e6-bf2d-f756ae83795f Duration: 0.28 ms Billed Duration: 100 ms Memory Size: 128 MB Max Memory Used: 14 MB

Disclaimer

Use at your own risk. I compiled this for usage in a personal project where it worked fine.