0.1.0 • Published 1 year ago

caesar-hooks v0.1.0

Weekly downloads
-
License
-
Repository
-
Last release
1 year ago

This is a custom hook to encrypt a text message or text input using caesar cipher algortihm

  • A small and lightweight hook that is capable of encrypting a text message or text input

Installation

Install my-custom hook with npm / yarn

  npm install caesar-cipher-hook
  yarn add caesar-cipher-hook

Usage/Examples

Using useShiftRight - the character will shift to right depending on the number of times you want it to shift

import { useShiftRight, useShiftLeft } from 'caesar-cipher-hook'

function App() {

    const [value, shift, tempvalue] = useShiftRight('', 3)

  return (
      <div>
        <h1>Right Shift</h1>
        <input type="text" value={tempvalue} onChange={shift} placeholder="Text to encrypt" />
        <div>Result: {value}</div>
      </div>
  )  
}

Using useShiftLeft - the character will shift to left depending on the number of times you want it to shift

import { useShiftRight, useShiftLeft } from 'caesar-cipher-hook'

function App() {

    const [value, shift, tempvalue] = useShiftLeft('', 5)

  return (
      <div>
        <h1>Left Shift</h1>
        <input type="text" value={tempvalue} onChange={shift} placeholder="Text to encrypt" />
        <div>Result: {value}</div>
      </div>
  )  
}