New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
map returns all undefs for PERL_HASH_FUNC_DJB2 miniperl #13347
Comments
From @bulk88Created by @bulk88Using PERL_HASH_FUNC_DJB2 with miniperl, map() passed all undef $_s to sample script my @arr = ('num1','num2','num3'); with DJB2 miniperl Use of uninitialized value $_ in concatenation (.) or string at Use of uninitialized value $_ in concatenation (.) or string at C:\Documents and Settings\Owner\Desktop\cpan libs\p519\perl\win32> with regular/default hash perl 5.10 ___________________________________________________ C:\Documents and Settings\Owner\Desktop\cpan libs\p519\perl\win32> Patch of hv_func.h that shows how I switched hash funcs is attached. This test script was cut down from write_buildcustomize.pl failing Perl Info
|
From @bulk88hv_func change.patchdiff --git "a/C:\\WINDOWS\\TEMP\\hv_69.tmp\\hv_func-b68084b-left.h" "b/C:\\Documents and Settings\\Owner\\Desktop\\cpan libs\\p519\\perl\\hv_func.h"
index 191912a..28b8367 100644
--- "a/C:\\WINDOWS\\TEMP\\hv_69.tmp\\hv_func-b68084b-left.h"
+++ "b/C:\\Documents and Settings\\Owner\\Desktop\\cpan libs\\p519\\perl\\hv_func.h"
@@ -22,7 +22,8 @@
|| defined(PERL_HASH_FUNC_ONE_AT_A_TIME_HARD) \
|| defined(PERL_HASH_FUNC_ONE_AT_A_TIME_OLD) \
)
-#define PERL_HASH_FUNC_ONE_AT_A_TIME_HARD
+//#define PERL_HASH_FUNC_ONE_AT_A_TIME_HARD
+#define PERL_HASH_FUNC_DJB2
#endif
#if defined(PERL_HASH_FUNC_SIPHASH)
|
From @bulk88C:\Documents and Settings\Owner\Desktop\cpan libs\p519\perl\win32>..\miniperl.ex C:\Documents and Settings\Owner\Desktop\cpan libs\p519\perl\win32> |
From @bulk88Changing the define to "#define PERL_HASH_FUNC_ONE_AT_A_TIME_OLD" does -- |
From @bulk88[16:32] <@rurban> PERL_HASH_FUNC_SDBM and PERL_HASH_FUNC_DJB2: simple fix: U32 hash = *((U32*)seed); untested by me, put here for safe keeping -- |
From zefram@fysh.orgbulk88 via RT wrote:
This apparently refers to the two lines U32 hash = *((U32*)seed + len); in hv_func.h, in S_perl_hash_sdbm() and S_perl_hash_djb2(), which look U32 hash = *((U32*)seed) + len; as seen in S_perl_hash_superfast() and two others. -zefram |
The RT System itself - Status changed from 'new' to 'open' |
From @rurbanOn Sat Apr 12 03:43:15 2014, zefram@fysh.org wrote:
sorry, but this is nonsense.
-- |
From zefram@fysh.orgReini Urban via RT wrote:
Why is it wrong to add the length into the hash at that point? -zefram |
From @rurbanOn Sat Apr 12 10:50:44 2014, zefram@fysh.org wrote:
We use a global hash seed. It makes no sense to mix that seed with the This is my current version of the patch |
From zefram@fysh.orgReini Urban via RT wrote:
I don't see how the scope of the seed is relevant to how the key length In the case of these two hash functions, DJB2 and SDBM, including the I don't know the real reason why these functions include the length. -zefram |
From @demerphqOn 12 April 2014 22:02, Zefram <zefram@fysh.org> wrote:
Your analysis is correct. It was made to harden these functions Yves -- |
From @demerphqOn 12 April 2014 19:47, Reini Urban via RT <perlbug-followup@perl.org> wrote:
No it is not. It is the correct fix to my change.
Adding the length is not 100% faithful to the original algorithm. See Zeframs mails for details.
No, don't. I will push patch for this, and it will look like Zefram posted.
I have no idea what you are talking about. Yves -- |
From @rurbanOn Apr 13, 2014, at 5:12 AM, demerphq <demerphq@gmail.com> wrote:
It is nonsense nevertheless, but it is the correct fix for the seed=0 case. The real fix for collision attacks is to avoid O(n/2) collision lookup.
Bad, because you wrote it and blogged about. To refresh your mind: |
From @tonycozOn Sat Apr 12 03:43:15 2014, zefram@fysh.org wrote:
This was fixed by Yves's 54e07e2. Closing. Tony |
@tonycoz - Status changed from 'open' to 'resolved' |
Migrated from rt.perl.org#120208 (status was 'resolved')
Searchable as RT120208$
The text was updated successfully, but these errors were encountered: