On Sat, 30 Jun 2012, Samuel Pitoiset wrote:

---
libavutil/Makefile |    1 +
libavutil/bf.c     |  410 ++++++++++++++++++++++++++++++++++++++++++++++++++++
libavutil/bf.h     |   59 ++++++++
3 files changed, 470 insertions(+), 0 deletions(-)
create mode 100644 libavutil/bf.c
create mode 100644 libavutil/bf.h

This needs a minor bump of libavutil.

bf feels a bit too short as name for this, I'd rather spell out the full name blowfish, same for the struct.

diff --git a/libavutil/Makefile b/libavutil/Makefile
index 6fe174b..b1f7183 100644
--- a/libavutil/Makefile
+++ b/libavutil/Makefile
@@ -51,6 +51,7 @@ OBJS = adler32.o                                              
          \
       audioconvert.o                                                   \
       avstring.o                                                       \
       base64.o                                                         \
+       bf.o                                                             \
       cpu.o                                                            \
       crc.o                                                            \
       des.o                                                            \
diff --git a/libavutil/bf.c b/libavutil/bf.c
new file mode 100644
index 0000000..afaeeae
--- /dev/null
+++ b/libavutil/bf.c
@@ -0,0 +1,410 @@
+/*
+ * Blowfish algorithm
+ * Copyright (c) 2012 Samuel Pitoiset
+ *
+ * loosely based on Paul Kocher's implementation
+ *
+ * This file is part of Libav.
+ *
+ * Libav is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * Libav is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with Libav; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#include "avutil.h"
+#include "common.h"
+#include "bf.h"
+
+typedef struct AVBF AVBF;

This feels odd... Either move the typedef to the header, or skip it completely.

+static uint32_t F(AVBF *bf, uint32_t x)
+{
+    uint16_t a, b, c, d;
+    uint32_t y;
+
+    d = (uint16_t)(x & 0xFF);
+    x >>= 8;
+    c = (uint16_t)(x & 0xFF);
+    x >>= 8;
+    b = (uint16_t)(x & 0xFF);
+    x >>= 8;
+    a = (uint16_t)(x & 0xFF);

The casts seem redundant to me

// Martin
_______________________________________________
libav-devel mailing list
[email protected]
https://lists.libav.org/mailman/listinfo/libav-devel

Reply via email to