[hyena] Add HYENA_MD5 method
- From: Gabriel Burt <gburt src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [hyena] Add HYENA_MD5 method
- Date: Wed, 26 May 2010 02:37:42 +0000 (UTC)
commit 1244ddfd34eb8364bd072a4e83adcb1470159f5c
Author: Gabriel Burt <gabriel burt gmail com>
Date: Thu May 13 16:35:57 2010 -0700
Add HYENA_MD5 method
Available in SQL statements; first arg is the # of args, and the
following are objects that will be added to a StringBuffer and MD5'd.
.../Hyena.Data.Sqlite/SqliteUtils.cs | 14 ++++++++++++++
1 files changed, 14 insertions(+), 0 deletions(-)
---
diff --git a/src/Hyena.Data.Sqlite/Hyena.Data.Sqlite/SqliteUtils.cs b/src/Hyena.Data.Sqlite/Hyena.Data.Sqlite/SqliteUtils.cs
index 979ccb3..31a8626 100644
--- a/src/Hyena.Data.Sqlite/Hyena.Data.Sqlite/SqliteUtils.cs
+++ b/src/Hyena.Data.Sqlite/Hyena.Data.Sqlite/SqliteUtils.cs
@@ -194,4 +194,18 @@ namespace Hyena.Data.Sqlite
return Hyena.StringUtil.SearchKey (args[0] as string);
}
}
+
+ [SqliteFunction (Name = "HYENA_MD5", FuncType = FunctionType.Scalar, Arguments = -1)]
+ internal class Md5Function : SqliteFunction
+ {
+ public override object Invoke (object[] args)
+ {
+ int n_args = (int)(long) args[0];
+ var sb = new StringBuilder ();
+ for (int i = 1; i <= n_args; i++) {
+ sb.Append (args[i]);
+ }
+ return Hyena.CryptoUtil.Md5Encode (sb.ToString (), System.Text.Encoding.UTF8);
+ }
+ }
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]