0
我试图从Blob中获取NSData
对象以将其加载到Web视图中。我已阅读关于SQLite.swift的文档,但我没有清楚。请帮帮我。我想我需要一个工作的例子。快速验证md5哈希密码
我的代码: https://gist.github.com/gobozgz/9d1b02364f878bc1a026
import UIKit
import SQLite
class AreaInfoViewController: UIViewController {
@IBOutlet weak var webView: UIWebView!
override func viewDidLoad() {
super.viewDidLoad()
// Here I Will load the webView PDFFile into the webView
// webView.loadRequest(getAreaPdf())
}
func getAreaPdf() -> NSDATA {
var myPdf:NSDATA // I think this is wrong
let dirPaths = NSSearchPathForDirectoriesInDomains(.DocumentDirectory, .UserDomainMask, true)
let docsDir = dirPaths[0]
let databasePath = docsDir.stringByAppendingString("/db.sqlite")
let db = try! Connection(databasePath, readonly: true)
let areas = Table("areas")
let id = Expression<Int64>("id")
let name = Expression<String>("name")
let pdffile = Expression<SQLite.Blob>("pdffile")
let query = areas.select(id,name,pdffile)
.filter(id == 1)
.limit(1)
let result = db.prepare(query)
for row in result {
myPdf = row[pdffile] // Obviusly this is wrong
}
return myPdf // Obviusly this is wrong too
}
}
问题是什么?顺便说一句,我希望你明白,MD5是一个星期的散列函数,这是不适合密码散列。 –
我想我犯了一个错误,并编辑了一个错误的问题。最后我使用了JKBCrypt和Bcript。 – GoBo