Advertisement
Guest User

Untitled

a guest
May 29th, 2015
261
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.42 KB | None | 0 0
  1. #include <inttypes.h>
  2. // cbmc -DPREFIX=0 -DSUFFIX=0 -DTARGET=1234 -DLEN=6 collision.c
  3. int main()
  4. {
  5. uint32_t prefix=PREFIX;
  6. uint32_t suffix=SUFFIX;
  7. unsigned char str[LEN];
  8.  
  9. uint32_t x = prefix;
  10. x ^= str[0] << 7;
  11. for(int i=0; i<LEN;i++) {
  12. __CPROVER_assume(str[i]<='z');
  13. __CPROVER_assume(str[i]>='0');
  14. x = (1000003*x) ^ str[i];
  15. }
  16. x ^= LEN;
  17. x ^= suffix;
  18. assert(x!=TARGET);
  19. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement