  TSI Gabe Premium,VIP join:2007-01-03 Chatham, ON
| C question
This may be unrelated to this forum but it's the closest thing I've found.
Basically what I'm trying to do is casting an array of char into an array of unsigned integers with their ascii value. for example "aaaa" would cast to 0x61616161. And this without using memcpy and would be as much as possible O(1).
I know the answer might be simple enough...but I can't seem to figure this one out. -- TSI Gabe - TekSavvy Solutions Inc. |
|
 dave Premium,MVM join:2000-05-04 not in ohio
·Verizon Online DSL
·Verizon FIOS
| This'll probably work:
x = *(unsigned int*)array
This is non-portable, dependent on the integer size, dependent on endianness, and may fail on architectures that require aligned integers. There is no solution without data movement, otherwise. |
|
  nwrickert sand groper Premium,MVM join:2004-09-04 Geneva, IL
·AT&T U-Verse
·AT&T Midwest
| reply to TSI Gabe "abcd" could then be 0x61626364 or 0x64636261 depending on the byte order of the machine. This can get tricky if you want to avoid such problems. With copying allowed, there are library functions to avoid that problem ("htonl()" and friends). -- AT&T dsl; Westell 327w modem/router; openSuSE 11.0; firefox 3.0.1 |
|
  TSI Gabe Premium,VIP join:2007-01-03 Chatham, ON | I'm actually programming for one arch (PS3 Cell Processor to be exact) so that doesn't bother me.
It does appear to be working so thanks -- TSI Gabe - TekSavvy Solutions Inc. |
|
  TSI Gabe Premium,VIP join:2007-01-03 Chatham, ON | I guess might as well get it out there.
I've been able to reach arround 30 billion MD5 hashes per second using the 6 SPU cores on the PS3...I'm trying to make it even better still.. -- TSI Gabe - TekSavvy Solutions Inc. |
|
 dave Premium,MVM join:2000-05-04 not in ohio | So this is "cracking security for fun and profit with household toys" ? |
|
  TSI Gabe Premium,VIP join:2007-01-03 Chatham, ON
| said by dave :So this is "cracking security for fun and profit with household toys" ? I guess you can put it that way. -- TSI Gabe - TekSavvy Solutions Inc. |
|
 netjunk
join:2002-02-20 Centreville, VA
| reply to TSI Gabe You are not even using cell processors as Sony made sure users don't have direct access to ps3 hardware. So you shouldn't really expect too much out it. What you really need to do is to fix its firmware and then try to find a way to harness real ps3 power.  |
|
  TSI Gabe Premium,VIP join:2007-01-03 Chatham, ON | No you do have access to the SPUs (only 6 out of 8 though). The hypervisor controls access to the RSX video card and hard drive which isn't great I agree. -- TSI Gabe - TekSavvy Solutions Inc. |
|
  BeesTea Network Janitor Premium,VIP join:2003-03-08 00000
| reply to TSI Gabe said by TSI Gabe :I guess might as well get it out there. I've been able to reach arround 30 billion MD5 hashes per second using the 6 SPU cores on the PS3...I'm trying to make it even better still.. Thank ${diety} (or math) for salted hashes then.
What's your practical application? Cracking apache htpasswd files? -- Overpower, overcome. |
|
  Steve I'm a PC, so shut up Consultant join:2001-03-10 Yorba Linda, CA
1 edit | reply to TSI Gabe said by TSI Gabe : I've been able to reach arround 30 billion MD5 hashes per second using the 6 SPU cores on the PS3... I call bullshit.
30B MD5 hashes per second over 6 cores means 5B hashes per second per core. I suppose I could believe that the PS3 could do 5B CPU instructions per second per core, but I don't buy that it can do 5B MD5 hashes (even simple ones) per second. I doubt even the memory bandwidth is sufficient for that amount of computation.
Did you mean million?
Steve -- Stephen J. Friedl | Unix Wizard | Microsoft Security MVP | Tustin, California USA | my web site |
|
  Jetoni Premium join:2001-04-18 West Springfield, MA
1 edit | reply to TSI Gabe Getting ~5 billion hashes a second per core is next to impossible with a PS3 cell processor. Generating *one* MD5 hash requires many CPU instructions (each taking many clock cycles). I will have to concur with Steve on this one. You must have meant millions... |
|
  TSI Gabe Premium,VIP join:2007-01-03 Chatham, ON
| Yeah well the SPUs can do 5 billion hashes per SPU but without storing them back in memory. Of course the PS3 doesn't have enough memory bandwidth to handle it. Keep in mind that the SPUs can do 4 32 bit instructions per operand.
The problem I'm having is sending all that data back to the PPU which is proving to be impossible since it would fill up the PS3's memory in a few seconds, not to mention it couldn't handle it.
So the only viable thing it can do is search for one hash or maybe 4 at a time.
Anyway...I really don't have to prove myself. -- TSI Gabe - TekSavvy Solutions Inc. |
|
 dave Premium,MVM join:2000-05-04 not in ohio | reply to TSI Gabe Just for info, what is the length of the source string over which these hashes are generated? |
|
  Steve I'm a PC, so shut up Consultant join:2001-03-10 Yorba Linda, CA
1 edit | reply to TSI Gabe said by TSI Gabe :Anyway...I really don't have to prove myself. No, you don't, but that won't stop us from reaching our own conclusions based on the evidence here.
For instance, many onlookers will find it hard to reconcile your difficulties with basic C casting with the notion that you've implemented some killer hashing algorithm that appears to violate the laws of physics.
But in any case, good luck.
Steve -- Stephen J. Friedl | Unix Wizard | Microsoft Security MVP | Tustin, California USA | my web site |
|
  TSI Gabe Premium,VIP join:2007-01-03 Chatham, ON
| reply to dave said by dave :Just for info, what is the length of the source string over which these hashes are generated? 8 chars. So yes very simple. -- TSI Gabe - TekSavvy Solutions Inc. |
|
  BeesTea Network Janitor Premium,VIP join:2003-03-08 00000
| reply to Steve said by Steve :For instance, many onlookers will find it hard to reconcile your difficulties with basic C casting with the notion that you've implemented some killer hashing algorithm that appears to violate the laws of physics. Physics schmysics! -- Overpower, overcome. |
|
  GILXA1226 Premium,MVM join:2000-12-29 London, OH clubs: | reply to TSI Gabe This code going to be open, or you are going to keep it closed? |
|
  TSI Gabe Premium,VIP join:2007-01-03 Chatham, ON | I'll open it up when I'm satisfied with what I have. -- TSI Gabe - TekSavvy Solutions Inc. |
|
 dave Premium,MVM join:2000-05-04 not in ohio
·Verizon Online DSL
·Verizon FIOS
| reply to Steve said by Steve :... that appears to violate the laws of physics. The PS3 uses logic elements made from resublimated thiotimoline. |
|