Git Product home page Git Product logo

compact-caesar-cipher's Introduction

$\textcolor{red}{\textsf{Compact Caesar Cipher}}$

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

GUI Python3 (Jupyter Notebook)

import ipywidgets
def r_string(s,k): return(''.join([ chr(97+(ord(c)-97+k)%26) for c in s ]))
def F():
    import ipywidgets as widgets
    from ipywidgets import HBox, VBox
    import numpy as np
    import matplotlib.pyplot as plt
    from IPython.display import display
    %matplotlib inline
    @widgets.interact
    def f(BOX=widgets.Text(value='abcdefghijklmnopqrstuvwxyz', disabled=False),k=range(0,26)):
        plain_text = BOX
        print(r_string(BOX,k))
F()

image image

def r_string(s,k): return(''.join([ chr(97+(ord(c)-97+k)%26) for c in s ]))

#https://github.com/jupyter-widgets/ipywidgets/issues/1775
import ipywidgets as widgets

out = widgets.Output()
def on_value_change(change):
    with out:
        #print("here ",change['new'])
        k=change['new']
        print(r_string("abc",k))
slider = widgets.IntSlider(min=1, max=26, step=1, continuous_update=True)
play = widgets.Play(min=1, interval=50)

slider.observe(on_value_change, 'value')
widgets.jslink((play, 'value'), (slider, 'value'))
widgets.VBox([play, slider, out])

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

JavaScript (js)

function rot(s,i) {return s.replace(/[a-zA-Z]/g, function (c) {  return String.fromCharCode((c <= 'Z' ? 90 : 122) >= (c = c.charCodeAt(0) + i) ? c : c - 26); });}

image

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

compact-caesar-cipher's People

Contributors

loneicewolf avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar  avatar

Forkers

zeldal1

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.