| 1 |
|
| #include "EXTERN.h" |
| 2 |
|
| #include "perl.h" |
| 3 |
|
| #include "XSUB.h" |
| 4 |
|
| |
| 5 |
|
| #define UCHAR unsigned char |
| 6 |
|
| |
| 7 |
|
| size_t |
| 8 |
1 |
| do_hash(const UCHAR* message) |
| 9 |
|
| { |
| 10 |
1 |
| size_t hash = 5381; |
| 11 |
|
| UCHAR c; |
| 12 |
|
| |
| 13 |
7 |
▶ | while (c = *message++) |
Branch: 1 branch
| Branch | True | False | Total |
| while (c = *message++) |
6 |
1 |
7 |
|
| 14 |
6 |
| hash = ((hash << 5) + hash) + c; /* hash * 33 + c */ |
| 15 |
|
| |
| 16 |
1 |
| return hash; |
| 17 |
|
| } |
| 18 |
|
| |
| 19 |
|
| MODULE = Digest::DJB PACKAGE = Digest::DJB |
| 20 |
|
| |
| 21 |
|
| size_t |
| 22 |
|
| djb(msg) |
| 23 |
|
| SV* msg |
| 24 |
|
| PROTOTYPE: $ |
| 25 |
|
| CODE: |
| 26 |
1 |
| RETVAL = do_hash(SvPV_nolen(msg)); |
| 27 |
|
| OUTPUT: |
| 28 |
|
| RETVAL |