Coder Social home page Coder Social logo

ibm / max-adversarial-cryptography Goto Github PK

View Code? Open in Web Editor NEW
12.0 24.0 11.0 20 KB

Protect communications with adversarial neural cryptography.

Home Page: https://developer.ibm.com/code/exchanges/models/

License: Apache License 2.0

Shell 100.00%

max-adversarial-cryptography's Introduction

IBM Developer Model Asset Exchange: Adversarial Cryptography Experiment

This repository contains code to run an Adversarial-Crypto experiment on IBM Watson Machine Learning. This experiment performs adversarial training to learn trivial encryption functions. The model is based on the TensorFlow implementation and the 2016 paper "Learning to Protect Communications with Adversarial Neural Cryptography" by Abadi and Andersen.

This experiment creates and trains three neural networks, termed Alice, Bob, and Eve. Alice takes inputs in_m (message), in_k (key) and outputs the ciphertext as a string. Bob takes inputs in_k, ciphertext and tries to reconstruct the message. Eve is an adversarial network that takes the ciphertext as its input and also tries to reconstruct the message. The main function attempts to train these networks and then evaluates them, all on random plaintext and key values.

This repository was developed as part of the IBM Code Model Asset Exchange

Model Metadata

Domain Application Industry Framework Training Data Input Data Format
Security Cryptography General TensorFlow Randomly generated text Text

References

Licenses

Component License Link
This repository Apache 2.0 LICENSE
Model Code (3rd party) Apache 2.0 TensorFlow Models

Quickstart

Prerequisites

Set Up an IBM Cloud Object Storage (COS) account

  • Create an IBM Cloud Object Storage account if you don't have one (https://www.ibm.com/cloud/storage)
  • Create credentials for either reading and writing or just reading
    • From the bluemix console page (https://console.bluemix.net/dashboard/apps/), choose Cloud Object Storage
    • On the left side, click the service credentials
    • Click on the new credentials button to create new credentials
    • In the 'Add New Credentials' popup, use this parameter {"HMAC":true} in the Add Inline Configuration...`
    • When you create the credentials, copy the access_key_id and secret_access_key values.
    • Make a note of the endpoint url
      • On the left side of the window, click on Endpoint
      • Copy the relevant public or private endpoint. [I choose the us-geo private endpoint].
  • In addition setup your AWS S3 command line which can be used to create buckets and/or add files to COS.
    • Export AWS_ACCESS_KEY_ID with your COS access_key_id and AWS_SECRET_ACCESS_KEY with your COS secret_access_key

Set Up IBM CLI & ML CLI

  • Install IBM Cloud CLI
    • Log in using bx login or bx login --sso if within IBM
  • Install ML CLI Plugin
    • After install, check if there is any plugins that need update
      • bx plugin update
    • Make sure to set up the various environment variables correctly:
      • ML_INSTANCE, ML_USERNAME, ML_PASSWORD, ML_ENV

Running the experiment

The run.sh utility script will deploy the experiment to WML and execute the experiment as a training-run

run.sh

Try this experiment in Fabric for Deep Learning

If you want to run this experiment using Fabric for Deep Learning (FFDL), You can simply clone the FfDL repository and follow the instructions over here to convert your training-runs.yml into FfDL's specification.

max-adversarial-cryptography's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

max-adversarial-cryptography's Issues

Enhance run script

@djalova we should take the new enhanced train.sh script you created and apply it to the existing MAX models.

Bucket name issue for the object storage

Following the instructions in README.md for training the model on WML, there was a bucket name issue as following:

make_bucket failed: s3://adversarial-crypto-training An error occurred (BucketAlreadyExists) when calling the CreateBucket operation: The requested bucket name is not available. The bucket namespace is shared by all users of the system. Please select a different name and try again. make_bucket failed: s3://adversarial-crypto-training-results An error occurred (BucketAlreadyExists) when calling the CreateBucket operation: The requested bucket name is not available. The bucket namespace is shared by all users of the system. Please select a different name and try again. Starting to train ... FAILED INVALID_ARGUMENT: Data store bucket 'adversarial-crypto-training' for data store id 'training-data-reference_name' incorrect, there may be a connection problem or credentials do not allow access to the bucket

It seems to be caused by the duplicated bucket name in the run.sh script. However, if I manually change the bucket name, another issue cames out as following:

make_bucket: adversarial-crypto-training-123 make_bucket: adversarial-crypto-training-results-123 Starting to train ... FAILED INVALID_ARGUMENT: Data store bucket 'adversarial-crypto-training' for data store id 'training-data-reference_name' incorrect, there may be a connection problem or credentials do not allow access to the bucket.

For this issue, I manually update the bucket name for training_data_reference and training_results_reference in training-runs.yml to be same as what I changed in run.sh. Then the model training could work on WML.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.