Pen Settings



CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URL's added here will be added as <link>s in order, and before the CSS in the editor. If you link to another Pen, it will include the CSS from that Pen. If the preprocessor matches, it will attempt to combine them before processing.

+ add another resource


Babel is required to process package imports. If you need a different preprocessor remove all packages first.

Add External Scripts/Pens

Any URL's added here will be added as <script>s in order, and run before the JavaScript in the editor. You can use the URL of any other Pen and it will include the JavaScript from that Pen.

+ add another resource


Save Automatically?

If active, Pens will autosave every 30 seconds after being saved once.

Auto-Updating Preview

If enabled, the preview panel updates automatically as you code. If disabled, use the "Run" button to update.

Format on Save

If enabled, your code will be formatted when you actively save your Pen. Note: your code becomes un-folded during formatting.

Editor Settings

Code Indentation

Want to change your Syntax Highlighting theme, Fonts and more?

Visit your global Editor Settings.


                <main class="vigenere__wrapper" id="vigenere">
   <h1 class="vigenere__title">
      Vigenere Encryption
   <div class="vigenere__modes">
      <div class="vigenere__radio">
         <input type="radio" id="encrypt" value="true" v-model="is_encrypting">
         <label for="encrypt">Encrypt</label>

      <div class="vigenere__radio">
         <input type="radio" id="decrypt" value="false" v-model="is_encrypting">
         <label for="decrypt">Decrypt</label>
   <textarea class="vigenere__input" rows="5" v-model="message"></textarea>
   <div class="vigenere__key">
      Secret key: <input type="text" v-model="key">
   <div class="vigenere__message">
      <h3 class="vigenere__message-banner">
         <span v-if=current_mode>Encrypted</span>
         <span v-else>Decrypted</span> Message


                $box-shadow-light: 0 2px 4px 0 rgba(0,0,0,0.10);
$box-shadow: 0 4px 8px 0 rgba(0,0,0,0.12), 0 2px 4px 0 rgba(0,0,0,0.08);

* { box-sizing: border-box; }

textarea {
   padding: 0.5rem;

   border: 1px solid #dddddd;
   border-radius: 3px;
   box-shadow: $box-shadow-light;

.vigenere__wrapper {
   padding: 1rem;
   min-height: 100vh;
   background-color: #f4fefd;

.vigenere__title { text-align: center; }

.vigenere__modes {
   display: flex;
   flex-wrap: wrap;
   align-items: center;
   justify-content: center;

.vigenere__radio {
   display: flex;
   padding: 0.5rem;
   input { margin-right: 0.33rem; }

.vigenere__input {
   display: block;
   width: 100%;
   margin: 0.5rem auto 1rem;
   max-width: 30rem;

.vigenere__key {
   display: flex;
   margin-bottom: 3rem;
   flex-wrap: wrap;
   align-items: center;
   justify-content: center;
   font-weight: 600;
   input { margin-left: 0.5rem; }

.vigenere__message {
   padding: 1.5rem;
   margin: 0 auto;
   max-width: 800px;
   box-shadow: $box-shadow;
   background-color: #fffefc;

   word-wrap: break-word;
   p {
      margin: 0;
      line-height: 1.25;

.vigenere__message-banner {
   margin-top: 0;
   text-align: center;


                new Vue({
   el: '#vigenere',
   data: {
      alphabet_array: ["A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z", "0", "1", "2", "3", "4", "5", "6", "7", "8", "9", ".", ",", "?", "!", "\'", "_", "-", "&", "@", "#", "$", "%", "*", "(", ")", " "],
      is_encrypting: 'true',
      message: 'This is a secret message to encrypt! In order to decode the below text, you will need the below key. Otherwise you get a jumble of crap. Anyway, the wifi password is swordfish.',
      key: 'Good fortune'
   methods: {
      convert_to_array: function(string) {
         return string.toUpperCase().split('');
      get_adjusted_key_array: function(item) {
         const item_index = this.alphabet_array.indexOf(item),
               before_index_array = this.alphabet_array.slice(0, item_index),
               after_index_array = this.alphabet_array.slice(item_index);
         return after_index_array.concat(before_index_array);
   computed: {
      current_mode: function() {
         return (this.is_encrypting === ("true" || true)) ? true : false;
      message_array: function(){ return this.convert_to_array(this.message); },
      key_array: function(){ return this.convert_to_array(this.key); },
      key_adjusted_arrays: function() {
         let adjusted_arrays = [];
         this.key_array.forEach(item => adjusted_arrays.push(this.get_adjusted_key_array(item)));
         return adjusted_arrays;
      encrypted_array: function() {
         const is_encrypting = this.current_mode,
               message_array = this.message_array,
               key_arrays = this.key_adjusted_arrays,
               alphabet_array = this.alphabet_array;
         let encrypted_array =, index){
           const current_index = (index % key_arrays.length),
                 current_key_array = key_arrays[current_index];

            if (is_encrypting) {
               const alphabet_index = alphabet_array.indexOf(item),
                     encrypted_character = current_key_array[alphabet_index];
               return encrypted_character;
            } else {
               const encrypted_index = current_key_array.indexOf(item),
                     decrypted_character = alphabet_array[encrypted_index];
               return decrypted_character;
         return encrypted_array;
      encrypted_message: function() {
         const is_encrypting = this.current_mode,
               encrypted_array = this.encrypted_array;
         let final_message = encrypted_array.reduce(function(acc, char, index) {    
           acc += char;     
           return acc; // Can also return other values based on the array
         }, '');
         if (!is_encrypting) {
            final_message = final_message.toLowerCase();
         return final_message;