testbf.pp 958 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. {
  2. $Id: header,v 1.1 2000/07/13 06:33:45 michael Exp $
  3. This file is part of the Free Component Library (FCL)
  4. Copyright (c) 1999-2000 by the Free Pascal development team
  5. See the file COPYING.FPC, included in this distribution,
  6. for details about the copyright.
  7. This program is distributed in the hope that it will be useful,
  8. but WITHOUT ANY WARRANTY; without even the implied warranty of
  9. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  10. **********************************************************************}
  11. { short test for blowfish unit }
  12. {$mode objfpc}
  13. {$h+}
  14. program testbf;
  15. uses blowfish;
  16. Var
  17. i : integer;
  18. L,R : TBFBlock;
  19. K : TBlowFishKey;
  20. begin
  21. L[0]:=$DEAD;
  22. L[1]:=$BEEF;
  23. R:=L;
  24. For I:=0 to 55 do
  25. K[i]:=Random(255)+1;
  26. With TBlowfish.Create(K,56) do
  27. Try
  28. Encrypt(L);
  29. Decrypt(L);
  30. If (L[0]<>R[0]) or (L[1]<>R[1]) then
  31. Writeln('Error');
  32. finally
  33. Free;
  34. end;
  35. end.