|
dan neely wrote:
Improved crytopgraphic attack methods and faster CPUs are increasing the likelyhood that they'll become vulnerable to bruteforce attacks in the semi-near future. Better algorythms include the SHA variants with longer bit lengths.
I am aware of this (fyi: its not so much as bruteforce as finding collisions in hashes produced by different documents) , I don't see the relevance to his problem though, because the hashes are compared on the DB side anyway.
|
|
|
|
|
If you are designing the authentication protocol try this:
Rmt: I want authorization
Host: Use this 64-bit random number
Rmt: append 64 bits to users password and run MD5/SHA-1/whatever and send hash to host
Host: run same hash algorithm and compare hashes
For more host side security only store hash of password. Rmt response must compute password hash (the one the host has stored) and append the 64 bits to that then run the final hash and send it off to the host.
In either case someone monitoring the entire data flow learns nothing about the actual key. Replay attacks are also foiled.
A similar approach would work with reasonably smart RFID chips.
|
|
|
|
|
Hi,
i want to know, how to measure the usage of CPU in %?
I've got a code, that returns me kernel time, user time and idle time of CPU in ticks (FILETIME), but i want it to be in percentage - like in UNIX 'top'.
How to convert and count it?
Best regards,
Krystian
P.s.
I understand that it might be wrong forum to post it, but i guess that converting ticks into percent is an algorithm.
Krystian
|
|
|
|
|
ok, nobody answered and i did the job ;]
Here's how:
First thing: kernel time is a sum of real kernel time and idle time, because of the fact, that cpu is always 'busy' - you can find Idle process in Windows Task Manager. So to get actual kernel cpu usage You will have to do: kf - idf.
Second thing: You can't count it just like that. GetSystemTimes gives You time spent on kernel/idle/user processes from the start of You system. So You have to get one time, wait like 100ms and get second time. Then substract the first from the second to get a delta.
You don't have to substract the miliseconds from the delta, because each of them's got it added, and You only count percentage.
Let's say that:
uf : user cpu time delta
kf : kernel cpu time delta
idf : idle cpu time delta
and now:
to get percent of cpu user time, You have to:
(uf / (idf + (kf - idf) + uf))*100
to get percent of cpu kernel time, You have to:
((kf - idf) / (idf + uf + (kf - idf)))*100
and the last thing, idle time:
(idf / (uf + (kf - idf) + idf))*100
Please note, that this is made on INT64, not on FILETIME that You will get from GetSystemTimes WinAPI function - You have to cast it properly.
Best regards,
Krystian
|
|
|
|
|
Nice thing you posted your solution even if you found it yourself Dziękują
|
|
|
|
|
krystian_pl wrote: ...how to measure the usage of CPU...
For a particular process, or the computer as a whole (i.e., all processes)?
"Approved Workmen Are Not Ashamed" - 2 Timothy 2:15
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
Hi all.
I am David and I am writing "big integer" class. In my class I use "long long Number[_NUMBER]" ( in C++) and I need algorithm of division,
it is not problem if this algorithm will use bit set and not "long long" type, I need that it was fast. In other words I need algorithm that divides one vector onto another
this vector can be vector of bits ( Ex: [1, 1, 1, 0, 0, 1, 0, 1, 0, 1] ) or vector of number ( Ex: [1258, 16546, 54646846, 54685, 088946, 555468, 8864, 11213, 1] )
Thanks for any help.
|
|
|
|
|
You could check out libGMP (GNU Multiple Precision Library), which is Open Source (zlib-licensed, IIRC) and does the same thing.
Alternatively, you could model the thing by re-implementing what you would do when you divide one number by another. Just do some divisions and model those steps. That, however, probably is not the best way to do divisions. You should check the "Math"-Forum for better algorithms.
|
|
|
|
|
I apologize. I missed the fact that you already posted this in the Math-Forum.
Thats what you get when you usually only read the VC-forums.
|
|
|
|
|
I'm working on a similar class LongMath.
Have you had any luck with division?
I've completed add, subtract and multiplication of negative/position whole and non-whole numbers but have been stuck on the division. I can divide negative/positive numbers but only whole numbers and I'd like to compare notes. Interested?
|
|
|
|
|
"Interested?"
Yes I am.
About your problem:
Use integer division for your non integer Number.
Ex:
121/11 = 11 if 1.21/11 = (121/11)*0.01
or
14/3 = 4+2/3 = 4+(20/3)*0.1 = 4+(6+2/3)*0.1 = 4+(6+(20/3)*0.1)*0.1=
=...=4+0.6+0.06+0.006+0.0006+.....
it is idea and math.I hope you like this.
Can you send my division algorithm?
|
|
|
|
|
I'll apply the above to my class and I'll email you my source or I'll email you a link to it.
Class Diagram::LongMath
<span style="width: 10px;"></span>Addition <br />
<span style="width: 20px;"></span>Add(sourceA <font color="#0000ff">As String</font>, sourceB <font color="#0000ff">As String</font>) <font color="#0000ff">As String</font><br />
<span style="width: 10px;"></span>Subtraction <br />
<span style="width: 20px;"></span>Subtract(sourceA <font color="#0000ff">As String</font>, sourceB <font color="#0000ff">As String</font>) <font color="#0000ff">As String</font><br />
<span style="width: 10px;"></span>Multiplication <br />
<span style="width: 20px;"></span>Multiply(sourceA <font color="#0000ff">As String</font>, sourceB <font color="#0000ff">As String</font>) <font color="#0000ff">As String</font><br />
<span style="width: 10px;"></span>Division<br />
<span style="width: 20px;"></span>Divide(divisor <font color="#0000ff">As String</font>, dividend <font color="#0000ff">As String</font>) <font color="#0000ff">As String</font><br />
This may take me a few days with the holidays here and all.
|
|
|
|
|
|
Hi,
I was playing around with a BigInteger class recently and so have come across the same problem.
The fastest way I could think of is below, if you say x / y = z (with remainder = r).
1. Find the leading 64 bits of your big number (x)
2. Find the leading 32 bits of your divisor (y).
3. Divide (1) by (2) to give you the leading 32 bits of z.
4. Multiply (3) by y and take this number from x
Continually applying steps 1-4 reduces the size of x until you are within +/- 1 of the correct value of z.
This is fast because all operations are O(n) or less if you code them properly!
Hope this is of some use & good luck!
Russ
|
|
|
|
|
Hi, I can't help specifically with c++ code to do long division .. but I wrote code in vb to do arbitrary precision floating point math.
The division method that I used turned out to be suprisingly fast and much easier to implement than addition or subtraction with signed floating point numbers.
The method is called the Newton-Raphson method or just Newton's method. I won't go into it here, just search for it, you'll find numerous examples.
I don't know how well it would would with integers only since the method uses multiplication, addition and subtraction iteratively but principal is sound anyway.
The guts of the divide method I wrote is this:
Do While Compare <> Guess
Compare = Guess
Guess = Left(Multiply(Subtract("2", Multiply(y, Guess)), Guess), Precision)
Loop
If your multiply, add and subtract methods can handle large numbers (this one uses strings) and you provide code to prevent the length of the result with each iteration from getting too long then sometime like may work. Each iteration will double the accuracy.
With another 50 or so lines of code this method can divide numbers thousands of digits long in milliseconds.
I also read somewhere where the Newton method is the fastest for divison.
|
|
|
|
|
i want to develop a website that contains a searching function on it, i'm using visual web developer as a machine and SQL server as a database,
i need to know about binary search, can anyone help me with the concept of binary search and how its work...?? i will really thankful...
-thank you-
|
|
|
|
|
MaSTaMaRViN wrote: can anyone help me with the concept of binary search
Google didn't turn up anything?
The evolution of the human genome is too important to be left to chance.
|
|
|
|
|
MaSTaMaRViN wrote: can anyone help me with the concept of binary search and how its work...??
It's much like searching for a name in the phone book. You start in the middle. If the name you are searching for is less than the current name, you can eliminate the right half of the phone book. If the name you are searching for is greater than the current name, you can eliminate the left half of the phone book. You now do the same search again, each time reducing the set by half. This is a very high-level observation.
"Approved Workmen Are Not Ashamed" - 2 Timothy 2:15
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
What you say is true at a high level, however searching for a name in the phone book is really more like interpolation search[^]. For example, if you know the name starts with 'B', then you can start much closer to the beginning than the halfway point. However, as the article states, the extra computation needed to find where to look often makes interpolation search not faster than binary search.
--
Marcus Kwok
|
|
|
|
|
Hello all,
I have created a sorting algorithm that is better than Quick Sort and even competes with Introspective Sort, but is constructed in a much simpler way.
I would like people to scrutinise the code, it is rather simple and shouldn't take long to look through. I want to know what people think of it. I have freely released the algorithm for anyone to use and develop further.
Please go to the following link to find out more:
http://www.geocities.com/nicemadnicemad/software.html
Thanks.
Chris Nash
Find the simplest proof and you have the ultimate truth.
|
|
|
|
|
A description of the algorithmm, and what makes it different from quicksort, would be nice (trawling through other peoples C sources isn't exactly a fun thing to do)
Developers, Developers, Developers, Developers, Developers, Developers, Velopers, Develprs, Developers! We are a big screwed up dysfunctional psychotic happy family - some more screwed up, others more happy, but everybody's psychotic joint venture definition of CP Linkify!|Fold With Us!
|
|
|
|
|
|
intrepid_is wrote: I have created a sorting algorithm that is better than Quick Sort...
How so?
"Approved Workmen Are Not Ashamed" - 2 Timothy 2:15
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
I looked at it (even though he found "better experts" ha! ) As I understand it, he needs knowledge of the smallest and largest value, so he has a better partitioning at quicksort.
Developers, Developers, Developers, Developers, Developers, Developers, Velopers, Develprs, Developers! We are a big screwed up dysfunctional psychotic happy family - some more screwed up, others more happy, but everybody's psychotic joint venture definition of CP Linkify!|Fold With Us!
|
|
|
|
|
Hello,
I'm a newbie in computer programming.
I'm looking for a program help me to change file attributes(Created time,Modified time and last access) like FileDate By T.YogaRamanan.
Here is link :
http://www.codeproject.com/file/FileDate.asp[^]
But I want to ignore its user interface.(No Dialog box , No Text box)
I want to choose file as coding and change file attribute as coding too.
I have tried to read source code of FileDate above.
I still can't do.
Can you help me ?
Thank you.
|
|
|
|