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 160493
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T11:02:41+00:00 2026-05-11T11:02:41+00:00

a C++ blowfish supports encrypting a block with less than < 8 letters,while .NET

  • 0

a C++ blowfish supports encrypting a block with less than < 8 letters,while .NET doesn’t.Why?

–>C# NET Blowfish<– –>C++ Blowfish<–

In both C++ and C# applications,I encrypt the following array

    byte response[6] =      {         0x00, 0x80, 0x01, 0x61, 0x05, 0x06     }; 

In both C++ and C# applications,I call the Encrypt function with same parameters.

C++ Blowfish.Encrypt((LPBYTE)responce + 2,(LPBYTE)responce + 2, 4);  C# Blowfish.Encrypt(responce, 2, responce, 2, responce.Length - 2); 

However,In C++ I get the data encrypted,but not in C#.

Line 45,47 and 49 in C# NET Blowfish are the problematic lines,after the calculation at line 45 – the result becomes 0. line 47 becomes 2 + 0 = 2 and line 49 2 is not less than 2,so there’s no loop.

There’s some padding in C++ blowfish,but I get lost when I try to understand it.

My problem is that in C#, the padding must be exactly the same as in C++,so I get a valid answer.I can’t use random padding and then remove the useless bytes after decryption,because the server I send the encrypted array is not mine.

Could you point me to what padding is used in the C++ blowfish and how it should be implemented in C# NET.

//Note I need not send this packet multiple times,only one time.

Thanks in advance!

  • 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. 2026-05-11T11:02:41+00:00Added an answer on May 11, 2026 at 11:02 am

    The code you pastebinned (not recommended for SO by the way, as your paste will be removed if noone reads it in a while, thereby leaving this question broken) says in its header comment:

    /// Note that the number of bytes must be adjusted to the block size of the algorithm. 

    (lines 3 and 4). So it seems to be behaving to spec, if it ignores your undersized data.

    The C++ code seems to be padding with null bytes, the comment says:

    // pad end of data with null bytes to complete encryption 

    It would be helpful to see the C++ function GetOutputLength(), to see how it handles undersized inputs. I guess it rounds upwards, but it would be nice to verify.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 75k
  • Answers 75k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • added an answer Found out how to do it. SubSonic has a method… May 11, 2026 at 2:36 pm
  • added an answer Your data type in .NET should be a string. You… May 11, 2026 at 2:36 pm
  • added an answer It is legal -- as in the OS won't stop… May 11, 2026 at 2:36 pm

Related Questions

My C++ program is using a standard blowfish. My C# program is using the
This is my 3rd thread concerning a blowfish problem in C#.Despite the fact I
I have a TCP Client,which puts a packet in a structure using System.Runtime.InteropServices; [StructLayoutAttribute(LayoutKind.Sequential)]
In a C++ Windows (XP and NT, if it makes a difference) application I'm

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

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.