Raised This Month: $ Target: $400
 0% 

File reading as ASCII/Binary (not inhibited by line breaks)


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Anpheus
Senior Member
Join Date: Aug 2004
Old 09-10-2004 , 18:15   File reading as ASCII/Binary (not inhibited by line breaks)
Reply With Quote #1

I've written a Small implementation of the simple SHA1 algorithm, I'm wondering how the best method would be of reading data from the file, ignoring line breaks?

Another question: Does standard md5, SHA1, etc, file hashing include the file header, and if so, how would I read that as an ASCII sequence in a clean manner?
Anpheus is offline
Anpheus
Senior Member
Join Date: Aug 2004
Old 09-11-2004 , 17:06  
Reply With Quote #2

bump.


Somebody's got to have a good method.
Anpheus is offline
malex
Junior Member
Join Date: Aug 2004
Old 09-11-2004 , 23:00  
Reply With Quote #3

1) You want to use the fread() native, from file.inc, to read without paying attention to the line breaks.

2) What header are you talking about? Normally, the digest is taken of the entire file contents.

\malex\
malex is offline
Anpheus
Senior Member
Join Date: Aug 2004
Old 09-12-2004 , 00:00  
Reply With Quote #4

Right, sorry, I meant handle.

I guess I misread it, handle makes way more sense than header. And that it returns a handle and what not... yeh.

Edit: Actually, I need to be able to -resume- from a specific spot as well.

SHA, Rijndael, etc, they dont require that the entire file is buffered immediately. Just in chunks. For SHA this is 512 bits, for Rijndael it is 128, 192, or 256.



So, how do I read directly from the file, from byte/bit x, to byte/bit x?
Anpheus is offline
Anpheus
Senior Member
Join Date: Aug 2004
Old 09-13-2004 , 16:27  
Reply With Quote #5

Hello?
Anpheus is offline
BAILOPAN
Join Date: Jan 2004
Old 09-13-2004 , 17:20  
Reply With Quote #6

I said it before, I'll say it again

small is not meant for this stuff. use a module
__________________
egg
BAILOPAN is offline
Twilight Suzuka
bad
Join Date: Jul 2004
Location: CS lab
Old 09-13-2004 , 18:16  
Reply With Quote #7

Small can handle it!
*pats smoking small*
...yeah. Module.
__________________
Twilight Suzuka is offline
Send a message via AIM to Twilight Suzuka Send a message via MSN to Twilight Suzuka
Anpheus
Senior Member
Join Date: Aug 2004
Old 09-13-2004 , 23:11  
Reply With Quote #8

Pfft, it can do it. I wrote SHA-1 in JASS..

JASS HAS NO BITWISE OPERATORS!



I can do it if I can just get it to read from a file. 512 bits at a time.
Anpheus is offline
BAILOPAN
Join Date: Jan 2004
Old 09-14-2004 , 00:54  
Reply With Quote #9

I don't care if you've written a Rijndael quine in brainfuck, the point is that doing this is just stupid.

The speed will be horrendously slow compared to that of a native C function. Did you not see the benchmarks comparing native small code to native C code? Have you the brain worms!?

Check out the amxxmodule sdk. it's quite nice. otherwise, take a look at file.inc there are C-style file functions there
__________________
egg
BAILOPAN is offline
Anpheus
Senior Member
Join Date: Aug 2004
Old 09-14-2004 , 17:35  
Reply With Quote #10

Haha... that's awesome. Brainfuck... the language.

Ok, ok, I guess I have to learn C++.
Anpheus is offline
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 17:12.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode