summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorruki <[email protected]>2016-08-03 13:55:04 +0800
committerruki <[email protected]>2016-08-03 13:55:04 +0800
commiteefd50df43ff0648e303194ff8378cd664381bff (patch)
treedb04fa1c6e0ae710f9e059601d2d868f6b61579d
parent4c34e6a5200687a543d3eeeedb6b403887f5b1a1 (diff)
impl os.uuid and update tbox for macosx and windows
-rwxr-xr-xcore/pkg/tbox.pkg/inc/mac/x64/tbox.config.h31
-rw-r--r--core/pkg/tbox.pkg/inc/msvc/x86/tbox.config.h3
-rwxr-xr-xcore/pkg/tbox.pkg/inc/tbox/container/vector.h2
-rwxr-xr-xcore/pkg/tbox.pkg/inc/tbox/hash/adler32.h66
-rwxr-xr-xcore/pkg/tbox.pkg/inc/tbox/hash/ap.h65
-rwxr-xr-xcore/pkg/tbox.pkg/inc/tbox/hash/bkdr.h65
-rwxr-xr-xcore/pkg/tbox.pkg/inc/tbox/hash/blizzard.h67
-rwxr-xr-xcore/pkg/tbox.pkg/inc/tbox/hash/crc.h97
-rwxr-xr-xcore/pkg/tbox.pkg/inc/tbox/hash/crc16.h92
-rwxr-xr-xcore/pkg/tbox.pkg/inc/tbox/hash/crc32.h92
-rwxr-xr-xcore/pkg/tbox.pkg/inc/tbox/hash/crc8.h73
-rwxr-xr-xcore/pkg/tbox.pkg/inc/tbox/hash/deprecated/adler32.h (renamed from core/pkg/tbox.pkg/inc/tbox/utils/fnv32.h)20
-rwxr-xr-xcore/pkg/tbox.pkg/inc/tbox/hash/deprecated/crc.h99
-rwxr-xr-xcore/pkg/tbox.pkg/inc/tbox/hash/deprecated/deprecated.h35
-rwxr-xr-xcore/pkg/tbox.pkg/inc/tbox/hash/deprecated/md5.h59
-rwxr-xr-xcore/pkg/tbox.pkg/inc/tbox/hash/deprecated/prefix.h33
-rwxr-xr-xcore/pkg/tbox.pkg/inc/tbox/hash/deprecated/sha.h59
-rwxr-xr-xcore/pkg/tbox.pkg/inc/tbox/hash/djb2.h67
-rwxr-xr-xcore/pkg/tbox.pkg/inc/tbox/hash/fnv32.h84
-rwxr-xr-xcore/pkg/tbox.pkg/inc/tbox/hash/fnv64.h84
-rwxr-xr-xcore/pkg/tbox.pkg/inc/tbox/hash/hash.h51
-rwxr-xr-xcore/pkg/tbox.pkg/inc/tbox/hash/md5.h95
-rwxr-xr-xcore/pkg/tbox.pkg/inc/tbox/hash/murmur.h67
-rwxr-xr-xcore/pkg/tbox.pkg/inc/tbox/hash/prefix.h33
-rwxr-xr-xcore/pkg/tbox.pkg/inc/tbox/hash/rs.h65
-rwxr-xr-xcore/pkg/tbox.pkg/inc/tbox/hash/sdbm.h65
-rwxr-xr-xcore/pkg/tbox.pkg/inc/tbox/hash/sha.h105
-rwxr-xr-xcore/pkg/tbox.pkg/inc/tbox/hash/uuid.h65
-rwxr-xr-x[-rw-r--r--]core/pkg/tbox.pkg/inc/tbox/libc/misc/setjmp.h0
-rw-r--r--[-rwxr-xr-x]core/pkg/tbox.pkg/inc/tbox/math/impl/random.h0
-rwxr-xr-xcore/pkg/tbox.pkg/inc/tbox/math/math.h2
-rw-r--r--[-rwxr-xr-x]core/pkg/tbox.pkg/inc/tbox/math/random.h0
-rwxr-xr-xcore/pkg/tbox.pkg/inc/tbox/math/random/linear.h59
-rwxr-xr-xcore/pkg/tbox.pkg/inc/tbox/math/random/prefix.h33
-rwxr-xr-xcore/pkg/tbox.pkg/inc/tbox/math/random/random.h84
-rwxr-xr-xcore/pkg/tbox.pkg/inc/tbox/platform/process.h2
-rwxr-xr-xcore/pkg/tbox.pkg/inc/tbox/platform/windows/interface/interface.h1
-rwxr-xr-xcore/pkg/tbox.pkg/inc/tbox/platform/windows/interface/ole32.h66
-rwxr-xr-xcore/pkg/tbox.pkg/inc/tbox/prefix/keyword.h8
-rwxr-xr-xcore/pkg/tbox.pkg/inc/tbox/prefix/trace.h3
-rwxr-xr-xcore/pkg/tbox.pkg/inc/tbox/tbox.h1
-rwxr-xr-xcore/pkg/tbox.pkg/inc/tbox/utils/singleton.h25
-rwxr-xr-xcore/pkg/tbox.pkg/inc/tbox/utils/utils.h5
-rwxr-xr-xcore/src/xmake/os/uuid.c6
-rw-r--r--xmake/core/sandbox/modules/os.lua11
45 files changed, 1996 insertions, 49 deletions
diff --git a/core/pkg/tbox.pkg/inc/mac/x64/tbox.config.h b/core/pkg/tbox.pkg/inc/mac/x64/tbox.config.h
index a330a7f95..da1a2fa56 100755
--- a/core/pkg/tbox.pkg/inc/mac/x64/tbox.config.h
+++ b/core/pkg/tbox.pkg/inc/mac/x64/tbox.config.h
@@ -6,7 +6,7 @@
#define TB_CONFIG_VERSION_MAJOR 1
#define TB_CONFIG_VERSION_MINOR 5
#define TB_CONFIG_VERSION_ALTER 3
-#define TB_CONFIG_VERSION_BUILD 201607122000
+#define TB_CONFIG_VERSION_BUILD 201608031341
// defines
#define TB_CONFIG_OS_MACOSX 1
@@ -21,9 +21,9 @@
#define TB_CONFIG_LIBC_HAVE_SETLOCALE 1
#define TB_CONFIG_POSIX_HAVE_POLL 1
#define TB_CONFIG_LIBC_HAVE_KILL 1
-#define TB_CONFIG_LIBM_HAVE_ATAN2 1
+#define TB_CONFIG_LIBC_HAVE_BACKTRACE 1
#define TB_CONFIG_POSIX_HAVE_SCHED_YIELD 1
-#define TB_CONFIG_LIBC_HAVE_WCSLEN 1
+#define TB_CONFIG_LIBC_HAVE_STRLEN 1
#define TB_CONFIG_LIBC_HAVE_WCSCMP 1
#define TB_CONFIG_LIBC_HAVE_WCSNCAT 1
#define TB_CONFIG_POSIX_HAVE_EXECVP 1
@@ -42,6 +42,7 @@
#define TB_CONFIG_LIBM_HAVE_ACOSF 1
#define TB_CONFIG_POSIX_HAVE_OPEN 1
#define TB_CONFIG_LIBC_HAVE_STRNLEN 1
+#define TB_CONFIG_LIBC_HAVE_RANDOM 1
#define TB_CONFIG_LIBM_HAVE_ATANF 1
#define TB_CONFIG_LIBC_HAVE_STRNCAT 1
#define TB_CONFIG_LIBC_HAVE_WCSNCPY 1
@@ -49,7 +50,7 @@
#define TB_CONFIG_LIBM_HAVE_TAN 1
#define TB_CONFIG_LIBM_HAVE_POWF 1
#define TB_CONFIG_LIBM_HAVE_SINF 1
-#define TB_CONFIG_LIBM_HAVE_ATAN 1
+#define TB_CONFIG_MODULE_HAVE_NETWORK 1
#define TB_CONFIG_LIBC_HAVE_STRNCMP 1
#define TB_CONFIG_LIBC_HAVE_MEMMOVE 1
#define TB_CONFIG_LIBC_HAVE_STRNCASECMP 1
@@ -68,44 +69,46 @@
#define TB_CONFIG_LIBC_HAVE_WCSLCPY 1
#define TB_CONFIG_SYSTEMV_HAVE_SEMGET 1
#define TB_CONFIG_POSIX_HAVE_WAITPID 1
+#define TB_CONFIG_POSIX_HAVE_WRITEV 1
+#define TB_CONFIG_POSIX_HAVE_READV 1
#define TB_CONFIG_LIBC_HAVE_GETTIMEOFDAY 1
#define TB_CONFIG_LIBC_HAVE_SIGNAL 1
#define TB_CONFIG_LIBC_HAVE_STRSTR 1
-#define TB_CONFIG_POSIX_HAVE_WRITEV 1
+#define TB_CONFIG_POSIX_HAVE_REGCOMP 1
#define TB_CONFIG_LIBC_HAVE_WCSNCMP 1
-#define TB_CONFIG_POSIX_HAVE_READV 1
+#define TB_CONFIG_POSIX_HAVE_SYSCONF 1
#define TB_CONFIG_LIBM_HAVE_LOG2 1
#define TB_CONFIG_LIBM_HAVE_COS 1
-#define TB_CONFIG_POSIX_HAVE_REGCOMP 1
+#define TB_CONFIG_POSIX_HAVE_GETPAGESIZE 1
#define TB_CONFIG_POSIX_HAVE_PTHREAD_MUTEX_INIT 1
#define TB_CONFIG_LIBM_HAVE_FMODF 1
-#define TB_CONFIG_POSIX_HAVE_SYSCONF 1
+#define TB_CONFIG_MODULE_HAVE_HASH 1
#define TB_CONFIG_LIBC_HAVE_WCSTOMBS 1
#define TB_CONFIG_LIBM_HAVE_FMOD 1
#define TB_CONFIG_LIBC_HAVE_MEMCMP 1
-#define TB_CONFIG_POSIX_HAVE_GETPAGESIZE 1
#define TB_CONFIG_POSIX_HAVE_SEM_INIT 1
#define TB_CONFIG_POSIX_HAVE_GETHOSTNAME 1
#define TB_CONFIG_POSIX_HAVE_OPENDIR 1
-#define TB_CONFIG_LIBM_HAVE_COSF 1
#define TB_CONFIG_LIBM_HAVE_ATAN2F 1
+#define TB_CONFIG_LIBM_HAVE_ATAN2 1
#define TB_CONFIG_LIBM_HAVE_EXP 1
#define TB_CONFIG_LIBM_HAVE_SIN 1
+#define TB_CONFIG_LIBM_HAVE_COSF 1
#define TB_CONFIG_POSIX_HAVE_PTHREAD_CREATE 1
#define TB_CONFIG_LIBM_HAVE_ASIN 1
#define TB_CONFIG_LIBM_HAVE_EXPF 1
-#define TB_CONFIG_LIBC_HAVE_STRLEN 1
+#define TB_CONFIG_LIBM_HAVE_ATAN 1
+#define TB_CONFIG_LIBM_HAVE_ASINF 1
#define TB_CONFIG_MODULE_HAVE_THREAD 1
-#define TB_CONFIG_MODULE_HAVE_NETWORK 1
#define TB_CONFIG_LIBC_HAVE_MEMMEM 1
#define TB_CONFIG_LIBC_HAVE_WCSCASECMP 1
#define TB_CONFIG_LIBC_HAVE_MBSTOWCS 1
#define TB_CONFIG_LIBC_HAVE_SIGSETJMP 1
#define TB_CONFIG_LIBM_HAVE_LOG2F 1
-#define TB_CONFIG_LIBM_HAVE_ASINF 1
+#define TB_CONFIG_LIBC_HAVE_SRANDOM 1
#define TB_CONFIG_LIBC_HAVE_SETJMP 1
#define TB_CONFIG_LIBC_HAVE_STRCASESTR 1
-#define TB_CONFIG_LIBC_HAVE_BACKTRACE 1
+#define TB_CONFIG_LIBC_HAVE_WCSLEN 1
// undefines
#undef TB_CONFIG_TRACE_INFO_ONLY
diff --git a/core/pkg/tbox.pkg/inc/msvc/x86/tbox.config.h b/core/pkg/tbox.pkg/inc/msvc/x86/tbox.config.h
index ed5554f14..3621ae4e2 100644
--- a/core/pkg/tbox.pkg/inc/msvc/x86/tbox.config.h
+++ b/core/pkg/tbox.pkg/inc/msvc/x86/tbox.config.h
@@ -6,7 +6,7 @@
#define TB_CONFIG_VERSION_MAJOR 1
#define TB_CONFIG_VERSION_MINOR 5
#define TB_CONFIG_VERSION_ALTER 3
-#define TB_CONFIG_VERSION_BUILD 201607130958
+#define TB_CONFIG_VERSION_BUILD 201608031342
// defines
#define TB_CONFIG_OS_WINDOWS 1
@@ -36,6 +36,7 @@
#define TB_CONFIG_LIBC_HAVE_WCSCAT 1
#define TB_CONFIG_LIBM_HAVE_POW 1
#define TB_CONFIG_LIBC_HAVE_MEMCPY 1
+#define TB_CONFIG_MODULE_HAVE_HASH 1
#define TB_CONFIG_LIBC_HAVE_WCSTOMBS 1
#define TB_CONFIG_LIBC_HAVE_WCSNLEN 1
#define TB_CONFIG_LIBC_HAVE_MEMCMP 1
diff --git a/core/pkg/tbox.pkg/inc/tbox/container/vector.h b/core/pkg/tbox.pkg/inc/tbox/container/vector.h
index 9ffae0401..6306fd7f9 100755
--- a/core/pkg/tbox.pkg/inc/tbox/container/vector.h
+++ b/core/pkg/tbox.pkg/inc/tbox/container/vector.h
@@ -188,7 +188,6 @@ tb_void_t tb_vector_insert_next(tb_vector_ref_t vector, tb_size_t itor
/*! insert the vector head item
*
* @param vector the vector
- * @param itor the item itor
* @param data the item data
*/
tb_void_t tb_vector_insert_head(tb_vector_ref_t vector, tb_cpointer_t data);
@@ -196,7 +195,6 @@ tb_void_t tb_vector_insert_head(tb_vector_ref_t vector, tb_cpointer_t
/*! insert the vector tail item
*
* @param vector the vector
- * @param itor the item itor
* @param data the item data
*/
tb_void_t tb_vector_insert_tail(tb_vector_ref_t vector, tb_cpointer_t data);
diff --git a/core/pkg/tbox.pkg/inc/tbox/hash/adler32.h b/core/pkg/tbox.pkg/inc/tbox/hash/adler32.h
new file mode 100755
index 000000000..b02c8a0f2
--- /dev/null
+++ b/core/pkg/tbox.pkg/inc/tbox/hash/adler32.h
@@ -0,0 +1,66 @@
+/*!The Treasure Box Library
+ *
+ * TBox 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.
+ *
+ * TBox 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 TBox;
+ * If not, see <a href="http://www.gnu.org/licenses/"> http://www.gnu.org/licenses/</a>
+ *
+ * Copyright (C) 2009 - 2015, ruki All rights reserved.
+ *
+ * @author ruki
+ * @file adler32.h
+ * @ingroup hash
+ *
+ */
+#ifndef TB_HASH_ADLER32_H
+#define TB_HASH_ADLER32_H
+
+/* //////////////////////////////////////////////////////////////////////////////////////
+ * includes
+ */
+#include "prefix.h"
+
+/* //////////////////////////////////////////////////////////////////////////////////////
+ * extern
+ */
+__tb_extern_c_enter__
+
+/* //////////////////////////////////////////////////////////////////////////////////////
+ * interfaces
+ */
+
+/*! make adler32 hash
+ *
+ * @param data the data
+ * @param size the size
+ * @param seed uses this seed if be non-zero
+ *
+ * @return the adler32 value
+ */
+tb_uint32_t tb_adler32_make(tb_byte_t const* data, tb_size_t size, tb_uint32_t seed);
+
+/*! make adler32 hash from c-string
+ *
+ * @param cstr the c-string
+ * @param seed uses this seed if be non-zero
+ *
+ * @return the adler32 value
+ */
+tb_uint32_t tb_adler32_make_from_cstr(tb_char_t const* cstr, tb_uint32_t seed);
+
+/* //////////////////////////////////////////////////////////////////////////////////////
+ * extern
+ */
+__tb_extern_c_leave__
+
+#endif
+
diff --git a/core/pkg/tbox.pkg/inc/tbox/hash/ap.h b/core/pkg/tbox.pkg/inc/tbox/hash/ap.h
new file mode 100755
index 000000000..33fac2e9b
--- /dev/null
+++ b/core/pkg/tbox.pkg/inc/tbox/hash/ap.h
@@ -0,0 +1,65 @@
+/*!The Treasure Box Library
+ *
+ * TBox 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.
+ *
+ * TBox 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 TBox;
+ * If not, see <a href="http://www.gnu.org/licenses/"> http://www.gnu.org/licenses/</a>
+ *
+ * Copyright (C) 2016, Olexander Yermakov All rights reserved.
+ *
+ * @author ruki
+ * @file ap.h
+ * @ingroup hash
+ *
+ */
+#ifndef TB_HASH_AP_H
+#define TB_HASH_AP_H
+
+/* //////////////////////////////////////////////////////////////////////////////////////
+ * includes
+ */
+#include "prefix.h"
+
+/* //////////////////////////////////////////////////////////////////////////////////////
+ * extern
+ */
+__tb_extern_c_enter__
+
+/* //////////////////////////////////////////////////////////////////////////////////////
+ * interfaces
+ */
+
+/*! make ap hash
+ *
+ * @param data the data
+ * @param size the size
+ * @param seed uses this seed if be non-zero
+ *
+ * @return the ap value
+ */
+tb_size_t tb_ap_make(tb_byte_t const* data, tb_size_t size, tb_size_t seed);
+
+/*! make ap hash from c-string
+ *
+ * @param cstr the c-string
+ * @param seed uses this seed if be non-zero
+ *
+ * @return the ap value
+ */
+tb_size_t tb_ap_make_from_cstr(tb_char_t const* cstr, tb_size_t seed);
+
+/* //////////////////////////////////////////////////////////////////////////////////////
+ * extern
+ */
+__tb_extern_c_leave__
+
+#endif
diff --git a/core/pkg/tbox.pkg/inc/tbox/hash/bkdr.h b/core/pkg/tbox.pkg/inc/tbox/hash/bkdr.h
new file mode 100755
index 000000000..00630339b
--- /dev/null
+++ b/core/pkg/tbox.pkg/inc/tbox/hash/bkdr.h
@@ -0,0 +1,65 @@
+/*!The Treasure Box Library
+ *
+ * TBox 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.
+ *
+ * TBox 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 TBox;
+ * If not, see <a href="http://www.gnu.org/licenses/"> http://www.gnu.org/licenses/</a>
+ *
+ * Copyright (C) 2016, Olexander Yermakov All rights reserved.
+ *
+ * @author ruki
+ * @file bkdr.h
+ * @ingroup hash
+ *
+ */
+#ifndef TB_HASH_BKDR_H
+#define TB_HASH_BKDR_H
+
+/* //////////////////////////////////////////////////////////////////////////////////////
+ * includes
+ */
+#include "prefix.h"
+
+/* //////////////////////////////////////////////////////////////////////////////////////
+ * extern
+ */
+__tb_extern_c_enter__
+
+/* //////////////////////////////////////////////////////////////////////////////////////
+ * interfaces
+ */
+
+/*! make bkdr hash
+ *
+ * @param data the data
+ * @param size the size
+ * @param seed uses this seed if be non-zero
+ *
+ * @return the bkdr value
+ */
+tb_size_t tb_bkdr_make(tb_byte_t const* data, tb_size_t size, tb_size_t seed);
+
+/*! make bkdr hash from c-string
+ *
+ * @param cstr the c-string
+ * @param seed uses this seed if be non-zero
+ *
+ * @return the bkdr value
+ */
+tb_size_t tb_bkdr_make_from_cstr(tb_char_t const* cstr, tb_size_t seed);
+
+/* //////////////////////////////////////////////////////////////////////////////////////
+ * extern
+ */
+__tb_extern_c_leave__
+
+#endif
diff --git a/core/pkg/tbox.pkg/inc/tbox/hash/blizzard.h b/core/pkg/tbox.pkg/inc/tbox/hash/blizzard.h
new file mode 100755
index 000000000..8bc19361e
--- /dev/null
+++ b/core/pkg/tbox.pkg/inc/tbox/hash/blizzard.h
@@ -0,0 +1,67 @@
+/*!The Treasure Box Library
+ *
+ * TBox 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.
+ *
+ * TBox 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 TBox;
+ * If not, see <a href="http://www.gnu.org/licenses/"> http://www.gnu.org/licenses/</a>
+ *
+ * Copyright (C) 2016, Olexander Yermakov All rights reserved.
+ *
+ * @author ruki
+ * @file blizzard.h
+ * @ingroup hash
+ *
+ */
+#ifndef TB_HASH_BLIZZARD_H
+#define TB_HASH_BLIZZARD_H
+
+/* //////////////////////////////////////////////////////////////////////////////////////
+ * includes
+ */
+#include "prefix.h"
+
+/* //////////////////////////////////////////////////////////////////////////////////////
+ * extern
+ */
+__tb_extern_c_enter__
+
+/* //////////////////////////////////////////////////////////////////////////////////////
+ * interfaces
+ */
+
+/*! make blizzard hash
+ *
+ * Blizzard One-Way Hash algorithm from MPQ
+ *
+ * @param data the data
+ * @param size the size
+ * @param seed uses this seed if be non-zero
+ *
+ * @return the blizzard value
+ */
+tb_size_t tb_blizzard_make(tb_byte_t const* data, tb_size_t size, tb_size_t seed);
+
+/*! make blizzard hash from c-string
+ *
+ * @param cstr the c-string
+ * @param seed uses this seed if be non-zero
+ *
+ * @return the blizzard value
+ */
+tb_size_t tb_blizzard_make_from_cstr(tb_char_t const* cstr, tb_size_t seed);
+
+/* //////////////////////////////////////////////////////////////////////////////////////
+ * extern
+ */
+__tb_extern_c_leave__
+
+#endif
diff --git a/core/pkg/tbox.pkg/inc/tbox/hash/crc.h b/core/pkg/tbox.pkg/inc/tbox/hash/crc.h
new file mode 100755
index 000000000..07c92eef2
--- /dev/null
+++ b/core/pkg/tbox.pkg/inc/tbox/hash/crc.h
@@ -0,0 +1,97 @@
+/*!The Treasure Box Library
+ *
+ * TBox 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.
+ *
+ * TBox 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 TBox;
+ * If not, see <a href="http://www.gnu.org/licenses/"> http://www.gnu.org/licenses/</a>
+ *
+ * Copyright (C) 2009 - 2015, ruki All rights reserved.
+ *
+ * @author ruki
+ * @file crc.h
+ * @ingroup hash
+ *
+ */
+#ifndef TB_HASH_CRC_H
+#define TB_HASH_CRC_H
+
+/* //////////////////////////////////////////////////////////////////////////////////////
+ * includes
+ */
+#include "prefix.h"
+
+/* //////////////////////////////////////////////////////////////////////////////////////
+ * macros
+ */
+
+// encode value
+#define tb_crc_make_value(mode, crc, value) tb_crc_make(mode, crc, (tb_byte_t const*)&(value), sizeof(value))
+
+/* //////////////////////////////////////////////////////////////////////////////////////
+ * extern
+ */
+__tb_extern_c_enter__
+
+/* //////////////////////////////////////////////////////////////////////////////////////
+ * types
+ */
+
+/// the crc mode type
+typedef enum __tb_crc_mode_t
+{
+#ifdef __tb_small__
+ TB_CRC_MODE_16_CCITT = 0
+, TB_CRC_MODE_32_IEEE_LE = 1
+, TB_CRC_MODE_MAX = 2
+#else
+ TB_CRC_MODE_8_ATM = 0
+, TB_CRC_MODE_16_ANSI = 1
+, TB_CRC_MODE_16_CCITT = 2
+, TB_CRC_MODE_32_IEEE = 3
+, TB_CRC_MODE_32_IEEE_LE = 4
+, TB_CRC_MODE_MAX = 5
+#endif
+
+}tb_crc_mode_t;
+
+/* //////////////////////////////////////////////////////////////////////////////////////
+ * interfaces
+ */
+
+/*! make crc
+ *
+ * @param mode the crc mode
+ * @param data the input data
+ * @param size the input size
+ * @param seed uses this seed if be non-zero
+ *
+ * @return the crc value
+ */
+tb_uint32_t tb_crc_make(tb_crc_mode_t mode, tb_byte_t const* data, tb_size_t size, tb_uint32_t seed);
+
+/*! make crc for cstr
+ *
+ * @param mode the crc mode
+ * @param cstr the input cstr
+ * @param seed uses this seed if be non-zero
+ *
+ * @return the crc value
+ */
+tb_uint32_t tb_crc_make_from_cstr(tb_crc_mode_t mode, tb_char_t const* cstr, tb_uint32_t seed);
+
+/* //////////////////////////////////////////////////////////////////////////////////////
+ * extern
+ */
+__tb_extern_c_leave__
+
+#endif
+
diff --git a/core/pkg/tbox.pkg/inc/tbox/hash/crc16.h b/core/pkg/tbox.pkg/inc/tbox/hash/crc16.h
new file mode 100755
index 000000000..6cce6b28f
--- /dev/null
+++ b/core/pkg/tbox.pkg/inc/tbox/hash/crc16.h
@@ -0,0 +1,92 @@
+/*!The Treasure Box Library
+ *
+ * TBox 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.
+ *
+ * TBox 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 TBox;
+ * If not, see <a href="http://www.gnu.org/licenses/"> http://www.gnu.org/licenses/</a>
+ *
+ * Copyright (C) 2009 - 2015, ruki All rights reserved.
+ *
+ * @author ruki
+ * @file crc16.h
+ * @ingroup hash
+ *
+ */
+#ifndef TB_HASH_CRC16_H
+#define TB_HASH_CRC16_H
+
+/* //////////////////////////////////////////////////////////////////////////////////////
+ * includes
+ */
+#include "prefix.h"
+
+/* //////////////////////////////////////////////////////////////////////////////////////
+ * macros
+ */
+
+// encode value
+#define tb_crc16_make_value(mode, crc, value) tb_crc16_make(mode, crc, (tb_byte_t const*)&(value), sizeof(value))
+
+/* //////////////////////////////////////////////////////////////////////////////////////
+ * extern
+ */
+__tb_extern_c_enter__
+
+/* //////////////////////////////////////////////////////////////////////////////////////
+ * interfaces
+ */
+
+/*! make crc16 (ANSI)
+ *
+ * @param data the input data
+ * @param size the input size
+ * @param seed uses this seed if be non-zero
+ *
+ * @return the crc value
+ */
+tb_uint16_t tb_crc16_make(tb_byte_t const* data, tb_size_t size, tb_uint16_t seed);
+
+/*! make crc16 (ANSI) for cstr
+ *
+ * @param cstr the input cstr
+ * @param seed uses this seed if be non-zero
+ *
+ * @return the crc value
+ */
+tb_uint16_t tb_crc16_make_from_cstr(tb_char_t const* cstr, tb_uint16_t seed);
+
+/*! make crc16 (CCITT)
+ *
+ * @param data the input data
+ * @param size the input size
+ * @param seed uses this seed if be non-zero
+ *
+ * @return the crc value
+ */
+tb_uint16_t tb_crc16_ccitt_make(tb_byte_t const* data, tb_size_t size, tb_uint16_t seed);
+
+/*! make crc16 (CCITT) for cstr
+ *
+ * @param cstr the input cstr
+ * @param seed uses this seed if be non-zero
+ *
+ * @return the crc value
+ */
+tb_uint16_t tb_crc16_ccitt_make_from_cstr(tb_char_t const* cstr, tb_uint16_t seed);
+
+/* //////////////////////////////////////////////////////////////////////////////////////
+ * extern
+ */
+__tb_extern_c_leave__
+
+#endif
+
diff --git a/core/pkg/tbox.pkg/inc/tbox/hash/crc32.h b/core/pkg/tbox.pkg/inc/tbox/hash/crc32.h
new file mode 100755
index 000000000..276abaae0
--- /dev/null
+++ b/core/pkg/tbox.pkg/inc/tbox/hash/crc32.h
@@ -0,0 +1,92 @@
+/*!The Treasure Box Library
+ *
+ * TBox 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.
+ *
+ * TBox 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 TBox;
+ * If not, see <a href="http://www.gnu.org/licenses/"> http://www.gnu.org/licenses/</a>
+ *
+ * Copyright (C) 2009 - 2015, ruki All rights reserved.
+ *
+ * @author ruki
+ * @file crc32.h
+ * @ingroup hash
+ *
+ */
+#ifndef TB_HASH_CRC32_H
+#define TB_HASH_CRC32_H
+
+/* //////////////////////////////////////////////////////////////////////////////////////
+ * includes
+ */
+#include "prefix.h"
+
+/* //////////////////////////////////////////////////////////////////////////////////////
+ * macros
+ */
+
+// encode value
+#define tb_crc32_make_value(mode, crc, value) tb_crc32_make(mode, crc, (tb_byte_t const*)&(value), sizeof(value))
+
+/* //////////////////////////////////////////////////////////////////////////////////////
+ * extern
+ */
+__tb_extern_c_enter__
+
+/* //////////////////////////////////////////////////////////////////////////////////////
+ * interfaces
+ */
+
+/*! make crc32 (IEEE)
+ *
+ * @param data the input data
+ * @param size the input size
+ * @param seed uses this seed if be non-zero
+ *
+ * @return the crc value
+ */
+tb_uint32_t tb_crc32_make(tb_byte_t const* data, tb_size_t size, tb_uint32_t seed);
+
+/*! make crc32 (IEEE) for cstr
+ *
+ * @param cstr the input cstr
+ * @param seed uses this seed if be non-zero
+ *
+ * @return the crc value
+ */
+tb_uint32_t tb_crc32_make_from_cstr(tb_char_t const* cstr, tb_uint32_t seed);
+
+/*! make crc32 (IEEE LE)
+ *
+ * @param data the input data
+ * @param size the input size
+ * @param seed uses this seed if be non-zero
+ *
+ * @return the crc value
+ */
+tb_uint32_t tb_crc32_le_make(tb_byte_t const* data, tb_size_t size, tb_uint32_t seed);
+
+/*! make crc32 (IEEE LE) for cstr
+ *
+ * @param cstr the input cstr
+ * @param seed uses this seed if be non-zero
+ *
+ * @return the crc value
+ */
+tb_uint32_t tb_crc32_le_make_from_cstr(tb_char_t const* cstr, tb_uint32_t seed);
+
+/* //////////////////////////////////////////////////////////////////////////////////////
+ * extern
+ */
+__tb_extern_c_leave__
+
+#endif
+
diff --git a/core/pkg/tbox.pkg/inc/tbox/hash/crc8.h b/core/pkg/tbox.pkg/inc/tbox/hash/crc8.h
new file mode 100755
index 000000000..633f67665
--- /dev/null
+++ b/core/pkg/tbox.pkg/inc/tbox/hash/crc8.h
@@ -0,0 +1,73 @@
+/*!The Treasure Box Library
+ *
+ * TBox 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.
+ *
+ * TBox 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 TBox;
+ * If not, see <a href="http://www.gnu.org/licenses/"> http://www.gnu.org/licenses/</a>
+ *
+ * Copyright (C) 2009 - 2015, ruki All rights reserved.
+ *
+ * @author ruki
+ * @file crc8.h
+ * @ingroup hash
+ *
+ */
+#ifndef TB_HASH_CRC8_H
+#define TB_HASH_CRC8_H
+
+/* //////////////////////////////////////////////////////////////////////////////////////
+ * includes
+ */
+#include "prefix.h"
+
+/* //////////////////////////////////////////////////////////////////////////////////////
+ * macros
+ */
+
+// encode value
+#define tb_crc8_make_value(mode, crc, value) tb_crc8_make(mode, crc, (tb_byte_t const*)&(value), sizeof(value))
+
+/* //////////////////////////////////////////////////////////////////////////////////////
+ * extern
+ */
+__tb_extern_c_enter__
+
+/* //////////////////////////////////////////////////////////////////////////////////////
+ * interfaces
+ */
+
+/*! make crc8 (ATM)
+ *
+ * @param data the input data
+ * @param size the input size
+ * @param seed uses this seed if be non-zero
+ *
+ * @return the crc value
+ */
+tb_uint8_t tb_crc8_make(tb_byte_t const* data, tb_size_t size, tb_uint8_t seed);
+
+/*! make crc8 (ATM) for cstr
+ *
+ * @param cstr the input cstr
+ * @param seed uses this seed if be non-zero
+ *
+ * @return the crc value
+ */
+tb_uint8_t tb_crc8_make_from_cstr(tb_char_t const* cstr, tb_uint8_t seed);
+
+/* //////////////////////////////////////////////////////////////////////////////////////
+ * extern
+ */
+__tb_extern_c_leave__
+
+#endif
+
diff --git a/core/pkg/tbox.pkg/inc/tbox/utils/fnv32.h b/core/pkg/tbox.pkg/inc/tbox/hash/deprecated/adler32.h
index e3fc63f9d..6f2b0691b 100755
--- a/core/pkg/tbox.pkg/inc/tbox/utils/fnv32.h
+++ b/core/pkg/tbox.pkg/inc/tbox/hash/deprecated/adler32.h
@@ -14,15 +14,15 @@
* along with TBox;
* If not, see <a href="http://www.gnu.org/licenses/"> http://www.gnu.org/licenses/</a>
*
- * Copyright (C) 2016, Olexander Yermakov All rights reserved.
+ * Copyright (C) 2009 - 2015, ruki All rights reserved.
*
- * @author alexyer
- * @file fnv32.h
- * @ingroup utils
+ * @author ruki
+ * @file adler32.h
+ * @ingroup hash
*
*/
-#ifndef TB_UTILS_FNV32_H
-#define TB_UTILS_FNV32_H
+#ifndef TB_HASH_DEPRECATED_ADLER32_H
+#define TB_HASH_DEPRECATED_ADLER32_H
/* //////////////////////////////////////////////////////////////////////////////////////
* includes
@@ -38,14 +38,15 @@ __tb_extern_c_enter__
* interfaces
*/
-/*! encode fnv32
+/*! encode adler32 hash
*
* @param data the data
* @param size the size
*
- * @return the fnv32 value
+ * @return the adler32 value
*/
-tb_uint32_t tb_fnv32_encode(tb_byte_t const* data, tb_size_t size);
+__tb_deprecated__
+tb_uint32_t tb_adler32_encode(tb_byte_t const* data, tb_size_t size);
/* //////////////////////////////////////////////////////////////////////////////////////
* extern
@@ -53,3 +54,4 @@ tb_uint32_t tb_fnv32_encode(tb_byte_t const* data, tb_size_t size);
__tb_extern_c_leave__
#endif
+
diff --git a/core/pkg/tbox.pkg/inc/tbox/hash/deprecated/crc.h b/core/pkg/tbox.pkg/inc/tbox/hash/deprecated/crc.h
new file mode 100755
index 000000000..98f1ca499
--- /dev/null
+++ b/core/pkg/tbox.pkg/inc/tbox/hash/deprecated/crc.h
@@ -0,0 +1,99 @@
+/*!The Treasure Box Library
+ *
+ * TBox 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.
+ *
+ * TBox 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 TBox;
+ * If not, see <a href="http://www.gnu.org/licenses/"> http://www.gnu.org/licenses/</a>
+ *
+ * Copyright (C) 2009 - 2015, ruki All rights reserved.
+ *
+ * @author ruki
+ * @file crc.h
+ * @ingroup hash
+ *
+ */
+#ifndef TB_HASH_DEPRECATED_CRC_H
+#define TB_HASH_DEPRECATED_CRC_H
+
+/* //////////////////////////////////////////////////////////////////////////////////////
+ * includes
+ */
+#include "prefix.h"
+
+/* //////////////////////////////////////////////////////////////////////////////////////
+ * macros
+ */
+
+// encode value
+#define tb_crc_encode_value(mode, crc, value) tb_crc_encode(mode, crc, (tb_byte_t const*)&(value), sizeof(value))
+
+/* //////////////////////////////////////////////////////////////////////////////////////
+ * extern
+ */
+__tb_extern_c_enter__
+
+/* //////////////////////////////////////////////////////////////////////////////////////
+ * types
+ */
+
+/// the crc mode type
+typedef enum __tb_crc_mode_t
+{
+#ifdef __tb_small__
+ TB_CRC_MODE_16_CCITT = 0
+, TB_CRC_MODE_32_IEEE_LE = 1
+, TB_CRC_MODE_MAX = 2
+#else
+ TB_CRC_MODE_8_ATM = 0
+, TB_CRC_MODE_16_ANSI = 1
+, TB_CRC_MODE_16_CCITT = 2
+, TB_CRC_MODE_32_IEEE = 3
+, TB_CRC_MODE_32_IEEE_LE = 4
+, TB_CRC_MODE_MAX = 5
+#endif
+
+}tb_crc_mode_t;
+
+/* //////////////////////////////////////////////////////////////////////////////////////
+ * interfaces
+ */
+
+/*! encode crc
+ *
+ * @param mode the crc mode
+ * @param crc the initial crc value
+ * @param data the input data
+ * @param size the input size
+ *
+ * @return the crc value
+ */
+__tb_deprecated__
+tb_uint32_t tb_crc_encode(tb_crc_mode_t mode, tb_uint32_t crc, tb_byte_t const* data, tb_size_t size);
+
+/*! encode crc for cstr
+ *
+ * @param mode the crc mode
+ * @param crc the initial crc value
+ * @param cstr the input cstr
+ *
+ * @return the crc value
+ */
+__tb_deprecated__
+tb_uint32_t tb_crc_encode_cstr(tb_crc_mode_t mode, tb_uint32_t crc, tb_char_t const* cstr);
+
+/* //////////////////////////////////////////////////////////////////////////////////////
+ * extern
+ */
+__tb_extern_c_leave__
+
+#endif
+
diff --git a/core/pkg/tbox.pkg/inc/tbox/hash/deprecated/deprecated.h b/core/pkg/tbox.pkg/inc/tbox/hash/deprecated/deprecated.h
new file mode 100755
index 000000000..01499da5b
--- /dev/null
+++ b/core/pkg/tbox.pkg/inc/tbox/hash/deprecated/deprecated.h
@@ -0,0 +1,35 @@
+/*!The Treasure Box Library
+ *
+ * TBox 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.
+ *
+ * TBox 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 TBox;
+ * If not, see <a href="http://www.gnu.org/licenses/"> http://www.gnu.org/licenses/</a>
+ *
+ * Copyright (C) 2009 - 2015, ruki All rights reserved.
+ *
+ * @author ruki
+ * @file deprecated.h
+ *
+ */
+#ifndef TB_HASH_DEPRECATED_H
+#define TB_HASH_DEPRECATED_H
+
+/* //////////////////////////////////////////////////////////////////////////////////////
+ * includes
+ */
+#include "crc.h"
+#include "md5.h"
+#include "sha.h"
+#include "deprecated.h"
+
+
+#endif
diff --git a/core/pkg/tbox.pkg/inc/tbox/hash/deprecated/md5.h b/core/pkg/tbox.pkg/inc/tbox/hash/deprecated/md5.h
new file mode 100755
index 000000000..3b045cc72
--- /dev/null
+++ b/core/pkg/tbox.pkg/inc/tbox/hash/deprecated/md5.h
@@ -0,0 +1,59 @@
+/*!The Treasure Box Library
+ *
+ * TBox 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.
+ *
+ * TBox is distributed ip 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 TBox;
+ * If not, see <a href="http://www.gnu.org/licenses/"> http://www.gnu.org/licenses/</a>
+ *
+ * Copyright (C) 2009 - 2015, ruki All rights reserved.
+ *
+ * @author ruki
+ * @file md5.h
+ * @ingroup hash
+ *
+ */
+#ifndef TB_HASH_DEPRECATED_MD5_H
+#define TB_HASH_DEPRECATED_MD5_H
+
+/* //////////////////////////////////////////////////////////////////////////////////////
+ * includes
+ */
+#include "prefix.h"
+
+/* //////////////////////////////////////////////////////////////////////////////////////
+ * extern
+ */
+__tb_extern_c_enter__
+
+/* //////////////////////////////////////////////////////////////////////////////////////
+ * interfaces
+ */
+
+/*! encode md5
+ *
+ * @param ib the input data
+ * @param in the input size
+ * @param ob the output data
+ * @param on the output size
+ *
+ * @return the real size
+ */
+__tb_deprecated__
+tb_size_t tb_md5_encode(tb_byte_t const* ib, tb_size_t in, tb_byte_t* ob, tb_size_t on);
+
+/* //////////////////////////////////////////////////////////////////////////////////////
+ * extern
+ */
+__tb_extern_c_leave__
+
+#endif
+
diff --git a/core/pkg/tbox.pkg/inc/tbox/hash/deprecated/prefix.h b/core/pkg/tbox.pkg/inc/tbox/hash/deprecated/prefix.h
new file mode 100755
index 000000000..093788755
--- /dev/null
+++ b/core/pkg/tbox.pkg/inc/tbox/hash/deprecated/prefix.h
@@ -0,0 +1,33 @@
+/*!The Treasure Box Library
+ *
+ * TBox 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.
+ *
+ * TBox 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 TBox;
+ * If not, see <a href="http://www.gnu.org/licenses/"> http://www.gnu.org/licenses/</a>
+ *
+ * Copyright (C) 2009 - 2015, ruki All rights reserved.
+ *
+ * @author ruki
+ * @file prefix.h
+ *
+ */
+#ifndef TB_HASH_DEPRECATED_PREFIX_H
+#define TB_HASH_DEPRECATED_PREFIX_H
+
+/* //////////////////////////////////////////////////////////////////////////////////////
+ * includes
+ */
+#include "../prefix.h"
+
+
+
+#endif
diff --git a/core/pkg/tbox.pkg/inc/tbox/hash/deprecated/sha.h b/core/pkg/tbox.pkg/inc/tbox/hash/deprecated/sha.h
new file mode 100755
index 000000000..286912b2a
--- /dev/null
+++ b/core/pkg/tbox.pkg/inc/tbox/hash/deprecated/sha.h
@@ -0,0 +1,59 @@
+/*!The Treasure Box Library
+ *
+ * TBox 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.
+ *
+ * TBox is distributed ip 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 TBox;
+ * If not, see <a href="http://www.gnu.org/licenses/"> http://www.gnu.org/licenses/</a>
+ *
+ * Copyright (C) 2009 - 2015, ruki All rights reserved.
+ *
+ * @author ruki
+ * @file sha.h
+ * @ingroup hash
+ *
+ */
+#ifndef TB_HASH_DEPRECATED_SHA_H
+#define TB_HASH_DEPRECATED_SHA_H
+
+/* //////////////////////////////////////////////////////////////////////////////////////
+ * includes
+ */
+#include "prefix.h"
+
+/* //////////////////////////////////////////////////////////////////////////////////////
+ * extern
+ */
+__tb_extern_c_enter__
+
+/* //////////////////////////////////////////////////////////////////////////////////////
+ * interfaces
+ */
+
+/*! encode sha
+ *
+ * @param ib the input data
+ * @param in the input size
+ * @param ob the output data
+ * @param on the output size
+ *
+ * @return the real size
+ */
+__tb_deprecated__
+tb_size_t tb_sha_encode(tb_size_t mode, tb_byte_t const* ib, tb_size_t ip, tb_byte_t* ob, tb_size_t on);
+
+/* //////////////////////////////////////////////////////////////////////////////////////
+ * extern
+ */
+__tb_extern_c_leave__
+
+#endif
+
diff --git a/core/pkg/tbox.pkg/inc/tbox/hash/djb2.h b/core/pkg/tbox.pkg/inc/tbox/hash/djb2.h
new file mode 100755
index 000000000..47e1895eb
--- /dev/null
+++ b/core/pkg/tbox.pkg/inc/tbox/hash/djb2.h
@@ -0,0 +1,67 @@
+/*!The Treasure Box Library
+ *
+ * TBox 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.
+ *
+ * TBox 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 TBox;
+ * If not, see <a href="http://www.gnu.org/licenses/"> http://www.gnu.org/licenses/</a>
+ *
+ * Copyright (C) 2016, Olexander Yermakov All rights reserved.
+ *
+ * @author ruki
+ * @file djb2.h
+ * @ingroup hash
+ *
+ */
+#ifndef TB_HASH_DJB2_H
+#define TB_HASH_DJB2_H
+
+/* //////////////////////////////////////////////////////////////////////////////////////
+ * includes
+ */
+#include "prefix.h"
+
+/* //////////////////////////////////////////////////////////////////////////////////////
+ * extern
+ */
+__tb_extern_c_enter__
+
+/* //////////////////////////////////////////////////////////////////////////////////////
+ * interfaces
+ */
+
+/*! make djb2 hash
+ *
+ * see http://www.cse.yorku.ca/~oz/hash.html
+ *
+ * @param data the data
+ * @param size the size
+ * @param seed uses this seed if be non-zero
+ *
+ * @return the djb2 value
+ */
+tb_size_t tb_djb2_make(tb_byte_t const* data, tb_size_t size, tb_size_t seed);
+
+/*! make djb2 hash from c-string
+ *
+ * @param cstr the c-string
+ * @param seed uses this seed if be non-zero
+ *
+ * @return the djb2 value
+ */
+tb_size_t tb_djb2_make_from_cstr(tb_char_t const* cstr, tb_size_t seed);
+
+/* //////////////////////////////////////////////////////////////////////////////////////
+ * extern
+ */
+__tb_extern_c_leave__
+
+#endif
diff --git a/core/pkg/tbox.pkg/inc/tbox/hash/fnv32.h b/core/pkg/tbox.pkg/inc/tbox/hash/fnv32.h
new file mode 100755
index 000000000..f0b46b18e
--- /dev/null
+++ b/core/pkg/tbox.pkg/inc/tbox/hash/fnv32.h
@@ -0,0 +1,84 @@
+/*!The Treasure Box Library
+ *
+ * TBox 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.
+ *
+ * TBox 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 TBox;
+ * If not, see <a href="http://www.gnu.org/licenses/"> http://www.gnu.org/licenses/</a>
+ *
+ * Copyright (C) 2016, Olexander Yermakov and ruki All rights reserved.
+ *
+ * @author alexyer, ruki
+ * @file fnv32.h
+ * @ingroup hash
+ *
+ */
+#ifndef TB_HASH_FNV32_H
+#define TB_HASH_FNV32_H
+
+/* //////////////////////////////////////////////////////////////////////////////////////
+ * includes
+ */
+#include "prefix.h"
+
+/* //////////////////////////////////////////////////////////////////////////////////////
+ * extern
+ */
+__tb_extern_c_enter__
+
+/* //////////////////////////////////////////////////////////////////////////////////////
+ * interfaces
+ */
+
+/*! make fnv32 hash
+ *
+ * @param data the data
+ * @param size the size
+ * @param seed uses this seed if be non-zero
+ *
+ * @return the fnv32 value
+ */
+tb_uint32_t tb_fnv32_make(tb_byte_t const* data, tb_size_t size, tb_uint32_t seed);
+
+/*! make fnv32 hash from c-string
+ *
+ * @param cstr the c-string
+ * @param seed uses this seed if be non-zero
+ *
+ * @return the fnv32 value
+ */
+tb_uint32_t tb_fnv32_make_from_cstr(tb_char_t const* cstr, tb_uint32_t seed);
+
+/*! make fnv32(1a) hash
+ *
+ * @param data the data
+ * @param size the size
+ * @param seed uses this seed if be non-zero
+ *
+ * @return the fnv32 value
+ */
+tb_uint32_t tb_fnv32_1a_make(tb_byte_t const* data, tb_size_t size, tb_uint32_t seed);
+
+/*! make fnv32(1a) hash from c-string
+ *
+ * @param cstr the c-string
+ * @param seed uses this seed if be non-zero
+ *
+ * @return the fnv32 value
+ */
+tb_uint32_t tb_fnv32_1a_make_from_cstr(tb_char_t const* cstr, tb_uint32_t seed);
+
+/* //////////////////////////////////////////////////////////////////////////////////////
+ * extern
+ */
+__tb_extern_c_leave__
+
+#endif
diff --git a/core/pkg/tbox.pkg/inc/tbox/hash/fnv64.h b/core/pkg/tbox.pkg/inc/tbox/hash/fnv64.h
new file mode 100755
index 000000000..df0068357
--- /dev/null
+++ b/core/pkg/tbox.pkg/inc/tbox/hash/fnv64.h
@@ -0,0 +1,84 @@
+/*!The Treasure Box Library
+ *
+ * TBox 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.
+ *
+ * TBox 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 TBox;
+ * If not, see <a href="http://www.gnu.org/licenses/"> http://www.gnu.org/licenses/</a>
+ *
+ * Copyright (C) 2016, Olexander Yermakov and ruki All rights reserved.
+ *
+ * @author alexyer, ruki
+ * @file fnv64.h
+ * @ingroup hash
+ *
+ */
+#ifndef TB_HASH_FNV64_H
+#define TB_HASH_FNV64_H
+
+/* //////////////////////////////////////////////////////////////////////////////////////
+ * includes
+ */
+#include "prefix.h"
+
+/* //////////////////////////////////////////////////////////////////////////////////////
+ * extern
+ */
+__tb_extern_c_enter__
+
+/* //////////////////////////////////////////////////////////////////////////////////////
+ * interfaces
+ */
+
+/*! make fnv64 hash
+ *
+ * @param data the data
+ * @param size the size
+ * @param seed uses this seed if be non-zero
+ *
+ * @return the fnv64 value
+ */
+tb_uint64_t tb_fnv64_make(tb_byte_t const* data, tb_size_t size, tb_uint64_t seed);
+
+/*! make fnv64 hash from c-string
+ *
+ * @param cstr the c-string
+ * @param seed uses this seed if be non-zero
+ *
+ * @return the fnv64 value
+ */
+tb_uint64_t tb_fnv64_make_from_cstr(tb_char_t const* cstr, tb_uint64_t seed);
+
+/*! make fnv64(1a) hash
+ *
+ * @param data the data
+ * @param size the size
+ * @param seed uses this seed if be non-zero
+ *
+ * @return the fnv64 value
+ */
+tb_uint64_t tb_fnv64_1a_make(tb_byte_t const* data, tb_size_t size, tb_uint64_t seed);
+
+/*! make fnv64(1a) hash from c-string
+ *
+ * @param cstr the c-string
+ * @param seed uses this seed if be non-zero
+ *
+ * @return the fnv64 value
+ */
+tb_uint64_t tb_fnv64_1a_make_from_cstr(tb_char_t const* cstr, tb_uint64_t seed);
+
+/* //////////////////////////////////////////////////////////////////////////////////////
+ * extern
+ */
+__tb_extern_c_leave__
+
+#endif
diff --git a/core/pkg/tbox.pkg/inc/tbox/hash/hash.h b/core/pkg/tbox.pkg/inc/tbox/hash/hash.h
new file mode 100755
index 000000000..d647253e9
--- /dev/null
+++ b/core/pkg/tbox.pkg/inc/tbox/hash/hash.h
@@ -0,0 +1,51 @@
+/*!The Treasure Box Library
+ *
+ * TBox 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.
+ *
+ * TBox 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 TBox;
+ * If not, see <a href="http://www.gnu.org/licenses/"> http://www.gnu.org/licenses/</a>
+ *
+ * Copyright (C) 2009 - 2015, ruki All rights reserved.
+ *
+ * @author ruki
+ * @file hash.h
+ * @defgroup hash
+ *
+ */
+#ifndef TB_HASH_H
+#define TB_HASH_H
+
+/* //////////////////////////////////////////////////////////////////////////////////////
+ * includes
+ */
+#include "prefix.h"
+#include "ap.h"
+#include "rs.h"
+#include "sha.h"
+#include "md5.h"
+#include "uuid.h"
+#include "djb2.h"
+#include "sdbm.h"
+#include "bkdr.h"
+#include "crc8.h"
+#include "crc16.h"
+#include "crc32.h"
+#include "fnv32.h"
+#include "fnv64.h"
+#include "murmur.h"
+#include "adler32.h"
+#include "blizzard.h"
+#ifdef TB_CONFIG_API_HAVE_DEPRECATED
+# include "deprecated/deprecated.h"
+#endif
+
+#endif
diff --git a/core/pkg/tbox.pkg/inc/tbox/hash/md5.h b/core/pkg/tbox.pkg/inc/tbox/hash/md5.h
new file mode 100755
index 000000000..93f559635
--- /dev/null
+++ b/core/pkg/tbox.pkg/inc/tbox/hash/md5.h
@@ -0,0 +1,95 @@
+/*!The Treasure Box Library
+ *
+ * TBox 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.
+ *
+ * TBox is distributed ip 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 TBox;
+ * If not, see <a href="http://www.gnu.org/licenses/"> http://www.gnu.org/licenses/</a>
+ *
+ * Copyright (C) 2009 - 2015, ruki All rights reserved.
+ *
+ * @author ruki
+ * @file md5.h
+ * @ingroup hash
+ *
+ */
+#ifndef TB_HASH_MD5_H
+#define TB_HASH_MD5_H
+
+/* //////////////////////////////////////////////////////////////////////////////////////
+ * includes
+ */
+#include "prefix.h"
+
+/* //////////////////////////////////////////////////////////////////////////////////////
+ * extern
+ */
+__tb_extern_c_enter__
+
+/* //////////////////////////////////////////////////////////////////////////////////////
+ * types
+ */
+
+// data structure for md5 (message data) computation
+typedef struct __tb_md5_t
+{
+ tb_uint32_t i[2]; //!< number of _bits_ handled mod 2^64
+ tb_uint32_t sp[4]; //!< scratch buffer
+ tb_byte_t ip[64]; //!< input buffer
+ tb_byte_t data[16]; //!< actual data after tb_md5_exit call
+
+}tb_md5_t;
+
+/* //////////////////////////////////////////////////////////////////////////////////////
+ * interfaces
+ */
+
+/*! init md5
+ *
+ * @param md5 the md5
+ * @param pseudo_rand the pseudo rand
+ */
+tb_void_t tb_md5_init(tb_md5_t* md5, tb_uint32_t pseudo_rand);
+
+/*! exit md5
+ *
+ * @param md5 the md5
+ * @param data the data
+ * @param size the size
+ */
+tb_void_t tb_md5_exit(tb_md5_t* md5, tb_byte_t* data, tb_size_t size);
+
+/*! spak md5
+ *
+ * @param md5 the md5
+ * @param data the data
+ * @param size the size
+ */
+tb_void_t tb_md5_spak(tb_md5_t* md5, tb_byte_t const* data, tb_size_t size);
+
+/*! make md5
+ *
+ * @param ib the input data
+ * @param in the input size
+ * @param ob the output data
+ * @param on the output size
+ *
+ * @return the real size
+ */
+tb_size_t tb_md5_make(tb_byte_t const* ib, tb_size_t in, tb_byte_t* ob, tb_size_t on);
+
+/* //////////////////////////////////////////////////////////////////////////////////////
+ * extern
+ */
+__tb_extern_c_leave__
+
+#endif
+
diff --git a/core/pkg/tbox.pkg/inc/tbox/hash/murmur.h b/core/pkg/tbox.pkg/inc/tbox/hash/murmur.h
new file mode 100755
index 000000000..bbd2071a8
--- /dev/null
+++ b/core/pkg/tbox.pkg/inc/tbox/hash/murmur.h
@@ -0,0 +1,67 @@
+/*!The Treasure Box Library
+ *
+ * TBox 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.
+ *
+ * TBox 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 TBox;
+ * If not, see <a href="http://www.gnu.org/licenses/"> http://www.gnu.org/licenses/</a>
+ *
+ * Copyright (C) 2016, Olexander Yermakov All rights reserved.
+ *
+ * @author ruki
+ * @file murmur.h
+ * @ingroup hash
+ *
+ */
+#ifndef TB_HASH_MURMUR_H
+#define TB_HASH_MURMUR_H
+
+/* //////////////////////////////////////////////////////////////////////////////////////
+ * includes
+ */
+#include "prefix.h"
+
+/* //////////////////////////////////////////////////////////////////////////////////////
+ * extern
+ */
+__tb_extern_c_enter__
+
+/* //////////////////////////////////////////////////////////////////////////////////////
+ * interfaces
+ */
+
+/*! make murmur hash
+ *
+ * one-byte-at-a-time hash based on Murmur's mix
+ *
+ * @param data the data
+ * @param size the size
+ * @param seed uses this seed if be non-zero
+ *
+ * @return the murmur value
+ */
+tb_size_t tb_murmur_make(tb_byte_t const* data, tb_size_t size, tb_size_t seed);
+
+/*! make murmur hash from c-string
+ *
+ * @param cstr the c-string
+ * @param seed uses this seed if be non-zero
+ *
+ * @return the murmur value
+ */
+tb_size_t tb_murmur_make_from_cstr(tb_char_t const* cstr, tb_size_t seed);
+
+/* //////////////////////////////////////////////////////////////////////////////////////
+ * extern
+ */
+__tb_extern_c_leave__
+
+#endif
diff --git a/core/pkg/tbox.pkg/inc/tbox/hash/prefix.h b/core/pkg/tbox.pkg/inc/tbox/hash/prefix.h
new file mode 100755
index 000000000..d2d05d07c
--- /dev/null
+++ b/core/pkg/tbox.pkg/inc/tbox/hash/prefix.h
@@ -0,0 +1,33 @@
+/*!The Treasure Box Library
+ *
+ * TBox 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.
+ *
+ * TBox 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 TBox;
+ * If not, see <a href="http://www.gnu.org/licenses/"> http://www.gnu.org/licenses/</a>
+ *
+ * Copyright (C) 2009 - 2015, ruki All rights reserved.
+ *
+ * @author ruki
+ * @file prefix.h
+ *
+ */
+#ifndef TB_HASH_PREFIX_H
+#define TB_HASH_PREFIX_H
+
+/* //////////////////////////////////////////////////////////////////////////////////////
+ * includes
+ */
+#include "../prefix.h"
+#include "../libc/libc.h"
+
+
+#endif
diff --git a/core/pkg/tbox.pkg/inc/tbox/hash/rs.h b/core/pkg/tbox.pkg/inc/tbox/hash/rs.h
new file mode 100755
index 000000000..8c54c4689
--- /dev/null
+++ b/core/pkg/tbox.pkg/inc/tbox/hash/rs.h
@@ -0,0 +1,65 @@
+/*!The Treasure Box Library
+ *
+ * TBox 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.
+ *
+ * TBox 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 TBox;
+ * If not, see <a href="http://www.gnu.org/licenses/"> http://www.gnu.org/licenses/</a>
+ *
+ * Copyright (C) 2016, Olexander Yermakov All rights reserved.
+ *
+ * @author ruki
+ * @file rs.h
+ * @ingroup hash
+ *
+ */
+#ifndef TB_HASH_RS_H
+#define TB_HASH_RS_H
+
+/* //////////////////////////////////////////////////////////////////////////////////////
+ * includes
+ */
+#include "prefix.h"
+
+/* //////////////////////////////////////////////////////////////////////////////////////
+ * extern
+ */
+__tb_extern_c_enter__
+
+/* //////////////////////////////////////////////////////////////////////////////////////
+ * interfaces
+ */
+
+/*! make rs hash
+ *
+ * @param data the data
+ * @param size the size
+ * @param seed uses this seed if be non-zero
+ *
+ * @return the rs value
+ */
+tb_size_t tb_rs_make(tb_byte_t const* data, tb_size_t size, tb_size_t seed);
+
+/*! make rs hash from c-string
+ *
+ * @param cstr the c-string
+ * @param seed uses this seed if be non-zero
+ *
+ * @return the rs value
+ */
+tb_size_t tb_rs_make_from_cstr(tb_char_t const* cstr, tb_size_t seed);
+
+/* //////////////////////////////////////////////////////////////////////////////////////
+ * extern
+ */
+__tb_extern_c_leave__
+
+#endif
diff --git a/core/pkg/tbox.pkg/inc/tbox/hash/sdbm.h b/core/pkg/tbox.pkg/inc/tbox/hash/sdbm.h
new file mode 100755
index 000000000..c310a563e
--- /dev/null
+++ b/core/pkg/tbox.pkg/inc/tbox/hash/sdbm.h
@@ -0,0 +1,65 @@
+/*!The Treasure Box Library
+ *
+ * TBox 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.
+ *
+ * TBox 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 TBox;
+ * If not, see <a href="http://www.gnu.org/licenses/"> http://www.gnu.org/licenses/</a>
+ *
+ * Copyright (C) 2016, Olexander Yermakov All rights reserved.
+ *
+ * @author ruki
+ * @file sdbm.h
+ * @ingroup hash
+ *
+ */
+#ifndef TB_HASH_SDBM_H
+#define TB_HASH_SDBM_H
+
+/* //////////////////////////////////////////////////////////////////////////////////////
+ * includes
+ */
+#include "prefix.h"
+
+/* //////////////////////////////////////////////////////////////////////////////////////
+ * extern
+ */
+__tb_extern_c_enter__
+
+/* //////////////////////////////////////////////////////////////////////////////////////
+ * interfaces
+ */
+
+/*! make sdbm hash
+ *
+ * @param data the data
+ * @param size the size
+ * @param seed uses this seed if be non-zero
+ *
+ * @return the sdbm value
+ */
+tb_size_t tb_sdbm_make(tb_byte_t const* data, tb_size_t size, tb_size_t seed);
+
+/*! make sdbm hash from c-string
+ *
+ * @param cstr the c-string
+ * @param seed uses this seed if be non-zero
+ *
+ * @return the sdbm value
+ */
+tb_size_t tb_sdbm_make_from_cstr(tb_char_t const* cstr, tb_size_t seed);
+
+/* //////////////////////////////////////////////////////////////////////////////////////
+ * extern
+ */
+__tb_extern_c_leave__
+
+#endif
diff --git a/core/pkg/tbox.pkg/inc/tbox/hash/sha.h b/core/pkg/tbox.pkg/inc/tbox/hash/sha.h
new file mode 100755
index 000000000..1ffa458da
--- /dev/null
+++ b/core/pkg/tbox.pkg/inc/tbox/hash/sha.h
@@ -0,0 +1,105 @@
+/*!The Treasure Box Library
+ *
+ * TBox 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.
+ *
+ * TBox is distributed ip 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 TBox;
+ * If not, see <a href="http://www.gnu.org/licenses/"> http://www.gnu.org/licenses/</a>
+ *
+ * Copyright (C) 2009 - 2015, ruki All rights reserved.
+ *
+ * @author ruki
+ * @file sha.h
+ * @ingroup hash
+ *
+ */
+#ifndef TB_HASH_SHA_H
+#define TB_HASH_SHA_H
+
+/* //////////////////////////////////////////////////////////////////////////////////////
+ * includes
+ */
+#include "prefix.h"
+
+/* //////////////////////////////////////////////////////////////////////////////////////
+ * extern
+ */
+__tb_extern_c_enter__
+
+/* //////////////////////////////////////////////////////////////////////////////////////
+ * types
+ */
+
+// data structure for sha (message data) computation
+typedef struct __tb_sha_t
+{
+ tb_uint8_t digest_len; //!< digest length in 32-bit words
+ tb_hize_t count; //!< number of bytes in buffer
+ tb_uint8_t buffer[64]; //!< 512-bit buffer of input values used in hash updating
+ tb_uint32_t state[8]; //!< current hash value
+ tb_void_t (*transform)(tb_uint32_t *state, tb_uint8_t const buffer[64]);
+
+}tb_sha_t;
+
+// the sha mode type
+typedef enum __tb_sha_mode_t
+{
+ TB_SHA_MODE_SHA1_160 = 160
+, TB_SHA_MODE_SHA2_224 = 224
+, TB_SHA_MODE_SHA2_256 = 256
+
+}tb_sha_mode_t;
+
+/* //////////////////////////////////////////////////////////////////////////////////////
+ * interfaces
+ */
+
+/*! init sha
+ *
+ * @param sha the sha
+ * @param mode the mode
+ */
+tb_void_t tb_sha_init(tb_sha_t* sha, tb_size_t mode);
+
+/*! exit sha
+ *
+ * @param sha the sha
+ * @param data the data
+ * @param size the size
+ */
+tb_void_t tb_sha_exit(tb_sha_t* sha, tb_byte_t* data, tb_size_t size);
+
+/*! spak sha
+ *
+ * @param sha the sha
+ * @param data the data
+ * @param size the size
+ */
+tb_void_t tb_sha_spak(tb_sha_t* sha, tb_byte_t const* data, tb_size_t size);
+
+/*! make sha
+ *
+ * @param ib the input data
+ * @param in the input size
+ * @param ob the output data
+ * @param on the output size
+ *
+ * @return the real size
+ */
+tb_size_t tb_sha_make(tb_size_t mode, tb_byte_t const* ib, tb_size_t ip, tb_byte_t* ob, tb_size_t on);
+
+/* //////////////////////////////////////////////////////////////////////////////////////
+ * extern
+ */
+__tb_extern_c_leave__
+
+#endif
+
diff --git a/core/pkg/tbox.pkg/inc/tbox/hash/uuid.h b/core/pkg/tbox.pkg/inc/tbox/hash/uuid.h
new file mode 100755
index 000000000..ffd24a601
--- /dev/null
+++ b/core/pkg/tbox.pkg/inc/tbox/hash/uuid.h
@@ -0,0 +1,65 @@
+/*!The Treasure Box Library
+ *
+ * TBox 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.
+ *
+ * TBox 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 TBox;
+ * If not, see <a href="http://www.gnu.org/licenses/"> http://www.gnu.org/licenses/</a>
+ *
+ * Copyright (C) 2009 - 2015, ruki All rights reserved.
+ *
+ * @author ruki
+ * @file uuid.h
+ * @ingroup hash
+ *
+ */
+#ifndef TB_HASH_UUID_H
+#define TB_HASH_UUID_H
+
+/* //////////////////////////////////////////////////////////////////////////////////////
+ * includes
+ */
+#include "prefix.h"
+
+/* //////////////////////////////////////////////////////////////////////////////////////
+ * extern
+ */
+__tb_extern_c_enter__
+
+/* //////////////////////////////////////////////////////////////////////////////////////
+ * interfaces
+ */
+
+/*! make an uuid
+ *
+ * @param uuid the uuid output buffer
+ * @param name we only generate it using a simple hashing function for speed if name is supplied
+ *
+ * @return tb_true or tb_false
+ */
+tb_bool_t tb_uuid_make(tb_byte_t uuid[16], tb_char_t const* name);
+
+/*! make an uuid string
+ *
+ * @param uuid_cstr the uuid output c-string
+ * @param name we only generate it using a simple hashing function for speed if name is supplied
+ *
+ * @return the uuid c-string or tb_null
+ */
+tb_char_t const* tb_uuid_make_cstr(tb_char_t uuid_cstr[37], tb_char_t const* name);
+
+/* //////////////////////////////////////////////////////////////////////////////////////
+ * extern
+ */
+__tb_extern_c_leave__
+
+#endif
+
diff --git a/core/pkg/tbox.pkg/inc/tbox/libc/misc/setjmp.h b/core/pkg/tbox.pkg/inc/tbox/libc/misc/setjmp.h
index b8583dcfd..b8583dcfd 100644..100755
--- a/core/pkg/tbox.pkg/inc/tbox/libc/misc/setjmp.h
+++ b/core/pkg/tbox.pkg/inc/tbox/libc/misc/setjmp.h
diff --git a/core/pkg/tbox.pkg/inc/tbox/math/impl/random.h b/core/pkg/tbox.pkg/inc/tbox/math/impl/random.h
index c73accf88..c73accf88 100755..100644
--- a/core/pkg/tbox.pkg/inc/tbox/math/impl/random.h
+++ b/core/pkg/tbox.pkg/inc/tbox/math/impl/random.h
diff --git a/core/pkg/tbox.pkg/inc/tbox/math/math.h b/core/pkg/tbox.pkg/inc/tbox/math/math.h
index 9eef102c4..9eefda77f 100755
--- a/core/pkg/tbox.pkg/inc/tbox/math/math.h
+++ b/core/pkg/tbox.pkg/inc/tbox/math/math.h
@@ -33,7 +33,7 @@
#include "fixed16.h"
#include "fixed30.h"
#include "fixed.h"
-#include "random.h"
+#include "random/random.h"
/* //////////////////////////////////////////////////////////////////////////////////////
* extern
diff --git a/core/pkg/tbox.pkg/inc/tbox/math/random.h b/core/pkg/tbox.pkg/inc/tbox/math/random.h
index f21a364ee..f21a364ee 100755..100644
--- a/core/pkg/tbox.pkg/inc/tbox/math/random.h
+++ b/core/pkg/tbox.pkg/inc/tbox/math/random.h
diff --git a/core/pkg/tbox.pkg/inc/tbox/math/random/linear.h b/core/pkg/tbox.pkg/inc/tbox/math/random/linear.h
new file mode 100755
index 000000000..f4ab1bd9d
--- /dev/null
+++ b/core/pkg/tbox.pkg/inc/tbox/math/random/linear.h
@@ -0,0 +1,59 @@
+/*!The Treasure Box Library
+ *
+ * TBox 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.
+ *
+ * TBox 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 TBox;
+ * If not, see <a href="http://www.gnu.org/licenses/"> http://www.gnu.org/licenses/</a>
+ *
+ * Copyright (C) 2009 - 2015, ruki All rights reserved.
+ *
+ * @author ruki
+ * @file linear.h
+ * @ingroup math
+ *
+ */
+#ifndef TB_MATH_RANDOM_LINEAR_H
+#define TB_MATH_RANDOM_LINEAR_H
+
+/* //////////////////////////////////////////////////////////////////////////////////////
+ * includes
+ */
+#include "prefix.h"
+
+/* //////////////////////////////////////////////////////////////////////////////////////
+ * extern
+ */
+__tb_extern_c_enter__
+
+/* //////////////////////////////////////////////////////////////////////////////////////
+ * interfaces
+ */
+
+/*! set the linear random seed
+ *
+ * @param seed the random seed
+ */
+tb_void_t tb_random_linear_seed(tb_size_t seed);
+
+/*! generate the linear random value
+ *
+ * @return the random value
+ */
+tb_long_t tb_random_linear_value(tb_noarg_t);
+
+/* //////////////////////////////////////////////////////////////////////////////////////
+ * extern
+ */
+__tb_extern_c_leave__
+
+#endif
+
diff --git a/core/pkg/tbox.pkg/inc/tbox/math/random/prefix.h b/core/pkg/tbox.pkg/inc/tbox/math/random/prefix.h
new file mode 100755
index 000000000..6eca3764e
--- /dev/null
+++ b/core/pkg/tbox.pkg/inc/tbox/math/random/prefix.h
@@ -0,0 +1,33 @@
+/*!The Treasure Box Library
+ *
+ * TBox 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.
+ *
+ * TBox 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 TBox;
+ * If not, see <a href="http://www.gnu.org/licenses/"> http://www.gnu.org/licenses/</a>
+ *
+ * Copyright (C) 2009 - 2015, ruki All rights reserved.
+ *
+ * @author ruki
+ * @file prefix.h
+ *
+ */
+#ifndef TB_MATH_RANDOM_PREFIX_H
+#define TB_MATH_RANDOM_PREFIX_H
+
+/* //////////////////////////////////////////////////////////////////////////////////////
+ * includes
+ */
+#include "../prefix.h"
+
+
+
+#endif
diff --git a/core/pkg/tbox.pkg/inc/tbox/math/random/random.h b/core/pkg/tbox.pkg/inc/tbox/math/random/random.h
new file mode 100755
index 000000000..e4a43efad
--- /dev/null
+++ b/core/pkg/tbox.pkg/inc/tbox/math/random/random.h
@@ -0,0 +1,84 @@
+/*!The Treasure Box Library
+ *
+ * TBox 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.
+ *
+ * TBox 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 TBox;
+ * If not, see <a href="http://www.gnu.org/licenses/"> http://www.gnu.org/licenses/</a>
+ *
+ * Copyright (C) 2009 - 2015, ruki All rights reserved.
+ *
+ * @author ruki
+ * @file random.h
+ *
+ */
+#ifndef TB_MATH_RANDOM_H
+#define TB_MATH_RANDOM_H
+
+/* //////////////////////////////////////////////////////////////////////////////////////
+ * includes
+ */
+#include "linear.h"
+
+/* //////////////////////////////////////////////////////////////////////////////////////
+ * extern
+ */
+__tb_extern_c_enter__
+
+/* //////////////////////////////////////////////////////////////////////////////////////
+ * interfaces
+ */
+
+/*! set the random seed
+ *
+ * @param seed the random seed
+ */
+tb_void_t tb_random_seed(tb_size_t seed);
+
+/*! reset value using the initial seed
+ */
+tb_void_t tb_random_reset(tb_noarg_t);
+
+/*! generate the random value
+ *
+ * it will generate a pseudo-random sequence if the seed is not modified manually.
+ *
+ * @return the random value
+ */
+tb_long_t tb_random_value(tb_noarg_t);
+
+/*! generate the random with range: [begin, end)
+ *
+ * @param begin the begin value
+ * @param end the end value
+ *
+ * @return the random value
+ */
+tb_long_t tb_random_range(tb_long_t begin, tb_long_t end);
+
+#ifdef TB_CONFIG_TYPE_HAVE_FLOAT
+/*! generate the float random with range: [begin, end)
+ *
+ * @param begin the begin value
+ * @param end the end value
+ *
+ * @return the random value
+ */
+tb_float_t tb_random_rangef(tb_float_t begin, tb_float_t end);
+#endif
+
+/* //////////////////////////////////////////////////////////////////////////////////////
+ * extern
+ */
+__tb_extern_c_leave__
+
+
+#endif
diff --git a/core/pkg/tbox.pkg/inc/tbox/platform/process.h b/core/pkg/tbox.pkg/inc/tbox/platform/process.h
index 1c36d1355..438245774 100755
--- a/core/pkg/tbox.pkg/inc/tbox/platform/process.h
+++ b/core/pkg/tbox.pkg/inc/tbox/platform/process.h
@@ -286,7 +286,7 @@ tb_long_t tb_process_wait(tb_process_ref_t process, tb_long_t* pst
// wait processes
tb_long_t infosize = -1;
- tb_process_waitinfo_t infolist[4] = {{0}};
+ tb_process_waitinfo_t infolist[4];
if ((infosize = tb_process_waitlist(processes1, infolist, tb_arrayn(infolist), -1)) > 0)
{
tb_size_t i = 0;
diff --git a/core/pkg/tbox.pkg/inc/tbox/platform/windows/interface/interface.h b/core/pkg/tbox.pkg/inc/tbox/platform/windows/interface/interface.h
index 24e843258..3467ec421 100755
--- a/core/pkg/tbox.pkg/inc/tbox/platform/windows/interface/interface.h
+++ b/core/pkg/tbox.pkg/inc/tbox/platform/windows/interface/interface.h
@@ -27,6 +27,7 @@
* includes
*/
#include "prefix.h"
+#include "ole32.h"
#include "user32.h"
#include "ws2_32.h"
#include "mswsock.h"
diff --git a/core/pkg/tbox.pkg/inc/tbox/platform/windows/interface/ole32.h b/core/pkg/tbox.pkg/inc/tbox/platform/windows/interface/ole32.h
new file mode 100755
index 000000000..19cee203d
--- /dev/null
+++ b/core/pkg/tbox.pkg/inc/tbox/platform/windows/interface/ole32.h
@@ -0,0 +1,66 @@
+/*!The Treasure Box Library
+ *
+ * TBox 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.
+ *
+ * TBox 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 TBox;
+ * If not, see <a href="http://www.gnu.org/licenses/"> http://www.gnu.org/licenses/</a>
+ *
+ * Copyright (C) 2009 - 2015, ruki All rights reserved.
+ *
+ * @author ruki
+ * @file ole32.h
+ *
+ */
+#ifndef TB_PLATFORM_WINDOWS_INTERFACE_OLE32_H
+#define TB_PLATFORM_WINDOWS_INTERFACE_OLE32_H
+
+/* //////////////////////////////////////////////////////////////////////////////////////
+ * includes
+ */
+#include "prefix.h"
+
+/* //////////////////////////////////////////////////////////////////////////////////////
+ * extern
+ */
+__tb_extern_c_enter__
+
+/* //////////////////////////////////////////////////////////////////////////////////////
+ * types
+ */
+
+// the CoCreateGuid func type
+typedef HRESULT (WSAAPI* tb_ole32_CoCreateGuid_t)(GUID* pguid);
+
+// the ole32 interfaces type
+typedef struct __tb_ole32_t
+{
+ // CoCreateGuid
+ tb_ole32_CoCreateGuid_t CoCreateGuid;
+
+}tb_ole32_t, *tb_ole32_ref_t;
+
+/* //////////////////////////////////////////////////////////////////////////////////////
+ * interfaces
+ */
+
+/* the ole32 interfaces
+ *
+ * @return the ole32 interfaces pointer
+ */
+tb_ole32_ref_t tb_ole32(tb_noarg_t);
+
+/* //////////////////////////////////////////////////////////////////////////////////////
+ * extern
+ */
+__tb_extern_c_leave__
+
+#endif
diff --git a/core/pkg/tbox.pkg/inc/tbox/prefix/keyword.h b/core/pkg/tbox.pkg/inc/tbox/prefix/keyword.h
index 246310bd2..dc262326e 100755
--- a/core/pkg/tbox.pkg/inc/tbox/prefix/keyword.h
+++ b/core/pkg/tbox.pkg/inc/tbox/prefix/keyword.h
@@ -179,6 +179,14 @@
# define __tb_export__
#endif
+#if defined(TB_COMPILER_IS_GCC) && __GNUC__ >= 3
+# define __tb_deprecated__ __attribute__((deprecated))
+#elif defined(TB_COMPILER_IS_MSVC) && defined(_MSC_VER) && _MSC_VER >= 1300
+# define __tb_deprecated__ __declspec(deprecated)
+#else
+# define __tb_deprecated__
+#endif
+
// has feature
#ifdef __has_feature
# define __tb_has_feature__(x) __has_feature(x)
diff --git a/core/pkg/tbox.pkg/inc/tbox/prefix/trace.h b/core/pkg/tbox.pkg/inc/tbox/prefix/trace.h
index 15fcbf4a4..68c508ba5 100755
--- a/core/pkg/tbox.pkg/inc/tbox/prefix/trace.h
+++ b/core/pkg/tbox.pkg/inc/tbox/prefix/trace.h
@@ -300,6 +300,9 @@ __tb_extern_c_enter__
// nosafe
#define tb_trace_nosafe() tb_trace1_w("nosafe")
+// deprecated
+#define tb_trace_deprecated() tb_trace1_w("deprecated")
+
/* //////////////////////////////////////////////////////////////////////////////////////
* declaration
*/
diff --git a/core/pkg/tbox.pkg/inc/tbox/tbox.h b/core/pkg/tbox.pkg/inc/tbox/tbox.h
index 190252505..76a64b0ff 100755
--- a/core/pkg/tbox.pkg/inc/tbox/tbox.h
+++ b/core/pkg/tbox.pkg/inc/tbox/tbox.h
@@ -33,6 +33,7 @@
#include "libm/libm.h"
#include "libc/libc.h"
#include "math/math.h"
+#include "hash/hash.h"
#include "utils/utils.h"
#include "regex/regex.h"
#include "object/object.h"
diff --git a/core/pkg/tbox.pkg/inc/tbox/utils/singleton.h b/core/pkg/tbox.pkg/inc/tbox/utils/singleton.h
index cf8170bc2..883da67f5 100755
--- a/core/pkg/tbox.pkg/inc/tbox/utils/singleton.h
+++ b/core/pkg/tbox.pkg/inc/tbox/utils/singleton.h
@@ -50,41 +50,38 @@ typedef enum __tb_singleton_type_e
/// the lock profiler type
, TB_SINGLETON_TYPE_LOCK_PROFILER = 2
- /// the random type
-, TB_SINGLETON_TYPE_RANDOM = 3
-
/// the ifaddrs type
-, TB_SINGLETON_TYPE_IFADDRS = 4
+, TB_SINGLETON_TYPE_IFADDRS = 3
/// the timer type
-, TB_SINGLETON_TYPE_TIMER = 5
+, TB_SINGLETON_TYPE_TIMER = 4
/// the ltimer type
-, TB_SINGLETON_TYPE_LTIMER = 6
+, TB_SINGLETON_TYPE_LTIMER = 5
/// the aicp type
-, TB_SINGLETON_TYPE_AICP = 7
+, TB_SINGLETON_TYPE_AICP = 6
/// the openssl library type
-, TB_SINGLETON_TYPE_LIBRARY_OPENSSL = 8
+, TB_SINGLETON_TYPE_LIBRARY_OPENSSL = 7
/// the mysql library type
-, TB_SINGLETON_TYPE_LIBRARY_MYSQL = 9
+, TB_SINGLETON_TYPE_LIBRARY_MYSQL = 8
/// the sqlite3 library type
-, TB_SINGLETON_TYPE_LIBRARY_SQLITE3 = 10
+, TB_SINGLETON_TYPE_LIBRARY_SQLITE3 = 9
/// the thread pool type
-, TB_SINGLETON_TYPE_THREAD_POOL = 11
+, TB_SINGLETON_TYPE_THREAD_POOL = 10
/// the transfer pool type
-, TB_SINGLETON_TYPE_TRANSFER_POOL = 12
+, TB_SINGLETON_TYPE_TRANSFER_POOL = 11
/// the cookies type
-, TB_SINGLETON_TYPE_COOKIES = 13
+, TB_SINGLETON_TYPE_COOKIES = 12
/// the user defined type
-, TB_SINGLETON_TYPE_USER = 14
+, TB_SINGLETON_TYPE_USER = 13
/// the max count of the singleton type
#ifdef __tb_small__
diff --git a/core/pkg/tbox.pkg/inc/tbox/utils/utils.h b/core/pkg/tbox.pkg/inc/tbox/utils/utils.h
index 9b3393fdf..88afb3b5c 100755
--- a/core/pkg/tbox.pkg/inc/tbox/utils/utils.h
+++ b/core/pkg/tbox.pkg/inc/tbox/utils/utils.h
@@ -29,9 +29,6 @@
*/
#include "prefix.h"
#include "bits.h"
-#include "sha.h"
-#include "md5.h"
-#include "crc.h"
#include "url.h"
#include "dump.h"
#include "used.h"
@@ -39,9 +36,7 @@
#include "base32.h"
#include "base64.h"
#include "option.h"
-#include "adler32.h"
#include "singleton.h"
#include "lock_profiler.h"
-#include "fnv32.h"
#endif
diff --git a/core/src/xmake/os/uuid.c b/core/src/xmake/os/uuid.c
index c30d52815..73faa383c 100755
--- a/core/src/xmake/os/uuid.c
+++ b/core/src/xmake/os/uuid.c
@@ -41,9 +41,11 @@ tb_int_t xm_os_uuid(lua_State* lua)
tb_assert_and_check_return_val(lua, 0);
// get the name
- tb_char_t const* name = luaL_checkstring(lua, 1);
- tb_used(name);
+ tb_char_t const* name = luaL_optstring(lua, 1, tb_null);
+ // make uuid
+ tb_char_t uuid[37];
+ lua_pushstring(lua, tb_uuid_make_cstr(uuid, name));
// ok
return 1;
diff --git a/xmake/core/sandbox/modules/os.lua b/xmake/core/sandbox/modules/os.lua
index 089ce5407..e0b6e28a9 100644
--- a/xmake/core/sandbox/modules/os.lua
+++ b/xmake/core/sandbox/modules/os.lua
@@ -404,6 +404,17 @@ function sandbox_os.setenv(name, values)
os.setenv(name, values)
end
+-- make a new uuid
+function sandbox_os.uuid(name)
+
+ -- make it
+ local uuid = os.uuid(name)
+ assert(uuid)
+
+ -- ok?
+ return uuid
+end
+
-- return module
return sandbox_os