View previous topic :: View next topic |
Author |
Message |
Fileburner
Joined: 28 Apr 2009 Posts: 11
|
Posted: Mon Sep 14, 2009 2:10 pm Post subject: [Help] problem with hashing(Digest), threading & DWT |
|
|
Hello everyone,
I am new to D programming language, and I am having some problems
I wanted to ask in the right forum "Tango" and "DWT" but I can't find tango forum and DWT forum is closed
I hope you don't mind if I ask for help in this forum.
ok here is my problemS
1 - I am trying to hash(Digest) a file using Tango's predefined digests. here is the code I used Code: | public void hashTestMethod(char[] filePath){
Md5 d = new Md5();
auto f = new FileConduit(filePath);
ubyte[] buffer = new ubyte[2048*1024];
int i = f.read(buffer);
while (i!=f.Eof){
d.update(buffer);
i = f.read(buffer);
}
txtResult.setText(d.hexDigest());
f.close();
} |
using this code I get a wrong result, but if I use the followig code I get the right result Code: | public void hashTestMethod(char[] filePath){
Md5 d = new Md5();
auto f = new FileConduit(filePath);
d.update(f.load());
txtResult.setText(d.hexDigest());
f.close();
} |
but the previous code loads the whole file to the memory which is not a good Idea
2 - is a problem I have with threading and DWT I would like to put a progressBar in my Form(Shell) which progresses according to processed file data, in other words while hashing the file progress the progressBar until the file is done hashing. can anyone please guide me how to do it, because I am new at threading
thank you.
Fileburner. |
|
Back to top |
|
|
doob
Joined: 06 Jan 2007 Posts: 367
|
|
Back to top |
|
|
Fileburner
Joined: 28 Apr 2009 Posts: 11
|
Posted: Tue Sep 15, 2009 7:34 am Post subject: |
|
|
thank you for your reply , I am gonna take a look a these links |
|
Back to top |
|
|
|