|
I'm trying to read in and decrypt some encrypted data that is written to a file by an outside program. The program uses a form of rijndael encryption to encrypt the file. It uses a key, and I have the key, but I don't think it uses an initialization vector ..
this is what it uses:
// key - The 128/192/256-bit user-key to use.
// chain - initial chain block for CBC and CFB modes.
// keylength - 16, 24 or 32 bytes
// blockSize - The block size in bytes of this Rijndael (16, 24 or 32 bytes).
I'm not real solid on how Rijndael encryption works, obviously, so if anyone could help steer me in the right direction, that would help.
|
|
|
|
|
Rijndael is just another name for AES encryption(as it was the technique chosen for the standard). I would start by reading up on AES. ...Start with the sci.crypt newsgroup
"I need build Skynet. Plz send code"
|
|
|
|
|
|
Dear All,
The standard utility for creating Deployments.
I want my installation utility to be intelligent enough to install WebSites, Web Services and Files.
Next I need a few .exe to run during the setup.
Please Help!!
Thank you!
"Mess with the Best, Die like the rest"
|
|
|
|
|
|
I put an attribute declaration on the top of a private object (in my case, a method). Yet I find out no attributes added to this method. Then, I change the method to a public one and it works. Is it true that "custom attributes cannot be applied to a private object"? Or, I did anything wrong? Please advice me if there's a way to walk throu. Many thanks in advance.
CY
|
|
|
|
|
Did it find the method? I suspect that it hasn't found the method because the binding flags haven't included the BindingFlags.NonPublic flag. The following code finds a custom attribute on a private member with no problem.
using System;
using System.Collections.Generic;
using System.Text;
using System.Reflection;
namespace SimpleTestApp
{
class Program
{
static void Main(string[] args)
{
BindingFlags flags = BindingFlags.Instance | BindingFlags.NonPublic;
MethodInfo mi = typeof(Program).GetMethod("MyMethod", flags);
Attribute[] att = (Attribute[])mi.GetCustomAttributes(typeof(MyAttribute), true);
if (att != null)
{
}
}
[MyAttribute("Hello")]
private void MyMethod()
{
}
}
public class MyAttribute : Attribute
{
private string _name;
public string Name
{
get { return _name; }
set { _name = value; }
}
public MyAttribute(string name)
: base()
{
_name = name;
}
}
}
Deja View - the feeling that you've seen this post before.
|
|
|
|
|
Pete O`Hanlon wrote: Did it find the method? I suspect that it hasn't found the method because the binding flags haven't included the BindingFlags.NonPublic flag. The following code finds a custom attribute on a private member with no problem.
Yes, you're right. That's not the problem of attribute. The method wasn't found instead. Thanks a lot for your advice.
CY
|
|
|
|
|
Does anybody know the specifics of "Simplified menu options and defaults"?
The version comparison Microsoft publishes on Studio 2005 doesn't go into any detail on this that I could find. Is anybody familiar enough with Professional and Standard editions to know what differences "Simplified menu options and defaults" entails?
I'm looking at finally buying a copy , and this is the only thing I'm concerned with between them. I think Standard is good enough for me, but I'm not sure on this one point.
|
|
|
|
|
Hi Everyone,
Thanks for taking the time to read my question!
I have an old unmanaged DLL that will handle all of the low level bootloader communications to a device on the serial port, however most of the functions in the DLL require a handle to the serial port. I also want to communicate with the device on the serial port using another protocol first (to put the device into bootloader mode) and this would be easiest done using some command classes that have already been written for another project using the System.IO.Ports.SerialPort class. Does anybody know of any fancy footwork that will allow me to begin using the serial port with the SerialPort class and then obtain a corresponding handle and pass that into the DLL calls?
I'm definately not an expert in this area - it's been enough just looking into marshalling to use the unmanaged DLL, but I'm really stuck on this problem.
Any help is greatly appreciated!
Chris Chambers.
|
|
|
|
|
If I am remembering right the handle you are looking for is ".SafeHandle". Just look down the intellisense list.
Phil
|
|
|
|
|
Hi Phil,
As far as I can see it's not possible to obtain a SafeHandle object from the SerialPort object. I might be missing something but I don't think it's obvious though.
Thanks anyway,
Chris.
|
|
|
|
|
Have you tried using the .CreateObjRef() method. You'll have to pass it the type of the low level dll, but it might work.
Hogan
|
|
|
|
|
Hi!
I need create a dll in VC++ and use in C#... But i can´t make this work
I made a new project:
New project > Visual C++ > CLR > Class Library
And write the files above, but when i import to C#´s project i can´t see the "test" function
So, anybody can help me?
Thank´s for the attention!
//########[Tsai7.cpp]########
#include "stdafx.h"
#include "Tsai7.h"
#include "math.h"
using namespace Tsai7;
public class Tsi
{
public: int test(int valor)
{
return valor;
}
};
//########[Tsai7.cpp]########
//#########[Tsai7.h]#########
#pragma once
using namespace System;
namespace Tsai7 {
public ref class Class1
{
public:
test(int valor);
};
}
//#########[Tsai7.h]#########
Rui Sousa
|
|
|
|
|
This is the C# forum and you are posting C++ code. You don't see a problem with that? Based on the limited information you provided I would guess you need to seek help in the (Mananged)C++/CLI forum.
If you are attempting to build a managed assembly using C++/CLI then you clearly have not spent enough time learning how CLI works. There is a massive amount of introductory material on this site (articles) and on MSDN for learning C++/CLI. I strongly recommend you start there.
|
|
|
|
|
Someone woke up on the wrong side of the bed this morning.. :/
|
|
|
|
|
hi
there tow solution for this
1 -
open your VC++ DLL Library with
Dependency Walker software ( it's come with all VS version ),
and get your right Entry point ,
if it's look dizzy like ( "@7&67test%43")
then open your library with any HexEditor , and replace this "@7&67test%43" with "test" ....
OR
2-
create a ‘.def’ file which informs the linker to export our function.
Select New from File menu and then select text File from Files tab. Give it a name example1.def. Now you can see an empty file . Add these lines in to example1.def
LIBRARY EXAMPLE1
EXPORTS
test @1
you can import it to C# like
<br />
using System;<br />
using System.Runtime.InteropServices;<br />
<br />
[DllImport("shell32.dll")]<br />
public static extern int test(int MyInt);<br />
bye
I know nothing , I know nothing
|
|
|
|
|
Hello,
how can I sort a big volume (hundreds of MBs) of ASCII data in C#?
Thanks,
Michal
|
|
|
|
|
Can you provide more information about the data. Maybe even a small example of the data.
Hogan
|
|
|
|
|
Sure, I'll be thankful for any help.
Basically, I've got txt files that contain information about Forex price ticks. Each row contains this information that I'm interested in:
- date/time
- price
Now the txt files overlap themselves in such a way that the ending part of one file contains exactly the same ticks as the beginning part of another file (this was to ensure that during the preceding export, no price ticks were omitted). Obviously, this is not true neither for the very first nor for the very last file.
The price ticks within a single file are guaranteed to not be duplicate.
If we want to get a continuous data stream that would only contain unique ticks (rows), the simple solution would be to load all rows from all files and sort the rows on: DateTime ASC, FileID ASC, RowNumber ASC.
Then I could go through all sorted rows and remove those that contain the same DateTime as the last valid DateTime, but with a new FileID. In other words, only ticks with the same FileID can have the same DateTime to ensure there are no duplicates.
Unfortunately, the DataTable object is throwing an OutOfMemoryException on me if I attempt to DataTable.Select() such a big chunk of data (about 15 million rows). The same happens with DataTable.DefaultView.Sort.
It works on smaller data sample with no memory exceptions being thrown, though.
Any ideas?
Thanks much for any input!
Michal
|
|
|
|
|
michal,
I'm no whiz like the other maniacs here on the forum, but here are some ideas. While they will take a few steps, they would work.
Option 1.
Download SQL Server Express and load your data into a SQL server table. Once there, you can do a select statement and order by anything you want.
Option 2.
Take the two pieces of data and combine them into a single string with a delimiter. Insert them into an ArrayList and then do an ArrayList.Sort(). I tried this on my computer, it took 2mins45 seconds and 1.5gb of ram to run... So if you have a powerful machine, this could work.
ArrayList al = new ArrayList();
for (int x = 0; x < 15000000; x++)
{
al.Add(System.Guid.NewGuid().ToString());
}
MessageBox.Show("Finished loading.");
al.Sort();
MessageBox.Show("Finished Sort.");
Anyway, I hope this helps give you a direction. Personally, i would go with the SQL server option as it is a bit more robust and will handle large amounts of data much better!
Hogan
|
|
|
|
|
Hello, Hogan, again,
well, the SQL solution is what I've been working on in the meantime while posting the question here, and it's probably going to be the best one. I was just curious whether I can do this in an easy way without SQL.
Option 2: I was thinking about using the ArrayList, too, but somehow I was too obsessed with the DataTable that I ruled this option out
Thanks for your help!
ANYWAY, why is the DataTable throwing the OutOfMemoryException? Is it only designed to handle small data samples? I seriously doubt it.
Thanks,
Michal
|
|
|
|
|
The data would have to be Xml (or loaded into XML) to sort without a database for that much information.
I was able to process 1,000,000 XML lines with System.Xml in > 9 secs on a bench mark I ran today for work.
As another senior coder was wondering how my program using 100's of XML files would preform...
|
|
|
|
|
That's impressive. I wouldn't even think about XML as the format itself is a kind of a synonymum to "SLOW" for me
But still, I was not able to find any caveat concerning loading big chunks of data into DataTable from Microsoft. The OutOfMemoryException occured during normal operation, I've got 2 GBs or RAM on my box with Win XP SP2 and the used RAM was only something like 1.4 GBs at the time. So that was definitely not the lack of physical memory.
So "there's something rotten in the state of DataTable" .. What is it?
Michal
|
|
|
|
|
Then my guess would be it is a permissions issue limiting the application...
|
|
|
|