Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8902115
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T01:31:55+00:00 2026-06-15T01:31:55+00:00

I came across this code: Byte Vigenere Cipher, error with decryption But trying to

  • 0

I came across this code:

Byte Vigenere Cipher, error with decryption

But trying to follow the rules I made a new question about it.

The following algorithm is used and I’m trying to get a better understanding into it:

Byte[] result= new Byte[plaintext.Length];

key = key.Trim().ToUpper();

int keyIndex = 0;
int keylength = key.Length;

for (int i = 0; i < plaintext.Length; i++)
{
    keyIndex = keyIndex % keylength;
    int shift = (int)key[keyIndex] - 65;
    result[i] = (byte)(((int)plaintext[i] + shift) % 256);
    keyIndex++;
}

Am I right in thinking the key needs to be trimmed as it is in Unicode? therefore subtracting 65 from a capital produces a common character/symbol?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-15T01:31:56+00:00Added an answer on June 15, 2026 at 1:31 am

    The ASCII value for the capital A is 65. All characters in key are converted to uppercase, this would simply return the alphabetical index of each letter in key.

    Each letter in key is converted to a number that way, and each letter in the original string is “shifted up the alphabet” that number of positions.

    If your key was BAD, this would turn into the numbers 1, 0 and 3, then applied to “hello world” as follows:

    Hello world
    10310310310 <-- added to each character
    Ieomo#xoumd
    

    You can demonstrate this by adding this code below yours:

    StringBuilder demonstration = new StringBuilder();
    foreach (byte b in result)
    {
        demonstration.Append((char)b);
    }
    Console.WriteLine(demonstration.ToString());
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Came across this code: <?php require_once 'HTTP/Session/Container/DB.php'; $s = new HTTP_Session_Container_DB('mysql://user:password@localhost/db'); ini_get('session.auto_start') or session_start();
I came across this code http://support.microsoft.com/kb/320348 which made me wonder what would be the
I came across this piece of code today: public static byte[] ReadContentFromFile(String filePath) {
I came across this code and was wondering what it means. But even after
I recently came across this in some code - basically someone trying to create
I came across this code on reddit . I would have thought that type
in the book i'm learning from i came across this code snippit: while (i
I was look at somebody else's code and came across this piece of code
I came across this Linq to Sql code in an application I am maintaining:
I came across this due to a bug in my code and I'm curious

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.