Click here to Skip to main content
15,893,588 members
Home / Discussions / C#
   

C#

 
AnswerRe: Single instance of a C# libraray across different processes Pin
Bernhard Hiller11-Aug-11 23:31
Bernhard Hiller11-Aug-11 23:31 
Questionrsync - Is there any open source library C#/C++/C which will give me the delta changes of file (it can be any type)? Pin
sujtha9-Aug-11 20:52
sujtha9-Aug-11 20:52 
AnswerRe: rsync - Is there any open source library C#/C++/C which will give me the delta changes of file (it can be any type)? Pin
OriginalGriff9-Aug-11 21:32
mveOriginalGriff9-Aug-11 21:32 
AnswerRe: rsync Pin
Matt Meyer10-Aug-11 4:22
Matt Meyer10-Aug-11 4:22 
QuestionGetting this simple crypto function to work in c#? Pin
stephen.darling9-Aug-11 11:12
stephen.darling9-Aug-11 11:12 
AnswerRe: Getting this simple crypto function to work in c#? Pin
MicroVirus9-Aug-11 12:20
MicroVirus9-Aug-11 12:20 
GeneralRe: Getting this simple crypto function to work in c#? Pin
stephen.darling9-Aug-11 12:26
stephen.darling9-Aug-11 12:26 
GeneralRe: Getting this simple crypto function to work in c#? Pin
MicroVirus9-Aug-11 12:56
MicroVirus9-Aug-11 12:56 
As far as I can understand from the code (and what I know from SHA1, which is a hashing algorithm), the actual SHA1 implementation doesn't use a key (can't use a key).
What happens in your C++ code is that you add the key as part of the 12 byte datablock-to-be-hashed: first 8 bytes of input data, then appended with a 4 byte constant key. You can just do the same in C# as you did in C++.
I admit I don't understand the actual algorithm you are using, but all you need to do is translate the code 1-to-1 from C++ to C#. The SHA1_* functions can be replaced with the SHA1 implementation (such as SHA1Managed) and the rest is almost directly valid C# code already.
About the memset function, it takes 3 parameters, memset(destination, value, countInBytes) and sets the first countInBytes bytes of destination to value.
memcpy(destination, source, count) copies count bytes from source to destination.

The algorithm itself is a bit funky with the memcpy's... It assumes a 16 byte InstID, but I guess that's alright?
GeneralRe: Getting this simple crypto function to work in c#? Pin
stephen.darling9-Aug-11 13:18
stephen.darling9-Aug-11 13:18 
GeneralRe: Getting this simple crypto function to work in c#? Pin
MicroVirus9-Aug-11 13:39
MicroVirus9-Aug-11 13:39 
GeneralRe: Getting this simple crypto function to work in c#? Pin
stephen.darling9-Aug-11 13:52
stephen.darling9-Aug-11 13:52 
GeneralRe: Getting this simple crypto function to work in c#? Pin
MicroVirus9-Aug-11 14:08
MicroVirus9-Aug-11 14:08 
GeneralRe: Getting this simple crypto function to work in c#? Pin
stephen.darling9-Aug-11 14:14
stephen.darling9-Aug-11 14:14 
AnswerRe: Getting this simple crypto function to work in c#? [modified] Pin
MicroVirus10-Aug-11 2:48
MicroVirus10-Aug-11 2:48 
GeneralRe: Getting this simple crypto function to work in c#? Pin
stephen.darling10-Aug-11 3:57
stephen.darling10-Aug-11 3:57 
GeneralRe: Getting this simple crypto function to work in c#? Pin
BobJanova10-Aug-11 4:00
BobJanova10-Aug-11 4:00 
GeneralRe: Getting this simple crypto function to work in c#? Pin
stephen.darling10-Aug-11 4:08
stephen.darling10-Aug-11 4:08 
GeneralRe: Getting this simple crypto function to work in c#? Pin
MicroVirus10-Aug-11 4:27
MicroVirus10-Aug-11 4:27 
AnswerRe: Getting this simple crypto function to work in c#? Pin
OriginalGriff9-Aug-11 21:39
mveOriginalGriff9-Aug-11 21:39 
GeneralRe: Getting this simple crypto function to work in c#? Pin
stephen.darling10-Aug-11 4:04
stephen.darling10-Aug-11 4:04 
GeneralRe: Getting this simple crypto function to work in c#? Pin
OriginalGriff10-Aug-11 4:21
mveOriginalGriff10-Aug-11 4:21 
AnswerRe: Getting this simple crypto function to work in c#? Pin
BobJanova9-Aug-11 23:18
BobJanova9-Aug-11 23:18 
GeneralRe: Getting this simple crypto function to work in c#? Pin
stephen.darling10-Aug-11 4:19
stephen.darling10-Aug-11 4:19 
GeneralRe: Getting this simple crypto function to work in c#? Pin
BobJanova10-Aug-11 8:22
BobJanova10-Aug-11 8:22 
GeneralRe: Getting this simple crypto function to work in c#? Pin
stephen.darling11-Aug-11 4:25
stephen.darling11-Aug-11 4:25 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.