Index: /trunk/msg.hpp
===================================================================
--- /trunk/msg.hpp	(revision 32)
+++ /trunk/msg.hpp	(revision 33)
@@ -175,5 +175,6 @@
 static cf::bin generateRandom()
 {
-	int t = (int)time(NULL);
+	srand((unsigned int)time(NULL));
+	int t = rand();
 
 	cf::bin b;
Index: /trunk/msgclnt.cpp
===================================================================
--- /trunk/msgclnt.cpp	(revision 32)
+++ /trunk/msgclnt.cpp	(revision 33)
@@ -89,9 +89,9 @@
 	SOpenSession o;
 
-	o.sessid = message.get<std::string>(ProtocolType::SESSION_ID);
-	o.idList = message.getList<std::string>(ProtocolType::ID_LIST);
-
 	if (message.mObject.HasKey(ProtocolType::SESSION_KEY))
 	{
+		o.sessid = message.get<std::string>(ProtocolType::SESSION_ID);
+		o.idList = message.getList<std::string>(ProtocolType::ID_LIST);
+
 		std::string encodedKey = message.get<std::string>(ProtocolType::SESSION_KEY);
 		cf::bin key = cf::codec::hex::getInstance()->decode(encodedKey);
Index: /trunk/msgsrv.cpp
===================================================================
--- /trunk/msgsrv.cpp	(revision 32)
+++ /trunk/msgsrv.cpp	(revision 33)
@@ -294,27 +294,34 @@
 }
 
-static unsigned int generateSeed()
-{
-	unsigned int ret = 0;
-	int t = (int)time(NULL);
-
-	cf::bin b;
-	b.resize(sizeof(int));
-
-	b.set((cf::uint8_t*)&t, sizeof(int));
-	cf::bin s = crypto().sha256(b);
-
-	memcpy(&ret, s.buffer(), sizeof(unsigned int));
-
-	return ret;
-}
-
 static std::string generateSMSCode()
 {
-	return "545454";
-	char random[8] = {0x00,};
-	sprintf(random, "%06d", generateSeed() % 1000000);
-
-	return random;
+	cf::bin random  = generateRandom(); // ·£´ý °ª °¡Á®¿È
+	cf::bin hash    = crypto().sha256(random); // ·£´ý °ª ÇØ½¬
+	std::string enc = cf::codec::hex::getInstance()->encode(hash); // ÇØ½¬ÇÑ °á°ú hex encode
+
+	std::string sms; // ÃÖÁ¾ sms¹ÞÀ» º¯¼ö
+
+	// xxxx-xxxx-xxxx-xxxx-xxxx-xxxx-xxxx-xxxx
+	for (int i = 0; i < 8 ; i++)
+	{
+		char buf[128] = {0,};
+
+		// [0] ºÎÅÍ 4±ÛÀÚ, [4] ºÎÅÍ 4±ÛÀÚ, ...
+		size_t start = i * 4;
+
+		// 1. enc º¯¼ö¿¡¼­ 4ÀÚ¸®¾¿ ¼ø¼­´ë·Î ¶¼¾î³»¼­ xxxx- ·Î ¸¸µë
+		//    std::string::substr(½ÃÀÛ ÀÎµ¦½º, °³¼ö)
+		// 2. std::string::substr() ´Â std::stringÀ» return ÇÏ¹Ç·Î,
+		//    std::string::c_str() ÇÏ¿© const char * ÇüÀ¸·Î ¹Þ¾Æ¿È
+		snprintf(buf, sizeof(buf), "%s-", enc.substr(start, 4).c_str());
+
+		// xxxx- ·Î ¸¸µç°Å sms °á°ú¿¡ Ãß°¡
+		sms += buf;
+	}
+
+	// ·çÇÁ¿¡¼­ xxxx- ¸¦ °è¼Ó ºÙ¿©¼­ ´Ù ¸¸µé°í ³ª¸é ¸¶Áö¸·ÀÌ '-' ·Î ³¡³ª°Ô µÇ¹Ç·Î ¸¶Áö¸· ±ÛÀÚ ¶¼¾î³¿
+	sms[sms.length() - 1] = 0;
+
+	return sms;
 }
 
@@ -325,6 +332,6 @@
 #define CRLF    "\r\n"
 	std::string code = generateSMSCode();
-	std::string url = "unsigned.kr";
-	std::string uri = "/~cheese/sms/req.php?to=" + phone + "&code=" + code;
+	std::string url = "chev.unsigned.kr";
+	std::string uri = "/sms/req.php?to=" + phone + "&code=" + code;
 	std::string http =
 		"GET " + uri + " HTTP/1.1" CRLF
Index: /trunk/msvc14/ChevMsgrClient_MFC/AddGroupChat.cpp
===================================================================
--- /trunk/msvc14/ChevMsgrClient_MFC/AddGroupChat.cpp	(revision 32)
+++ /trunk/msvc14/ChevMsgrClient_MFC/AddGroupChat.cpp	(revision 33)
@@ -41,5 +41,5 @@
 
 	for (size_t iter = 0; iter < mMsgrClntDlg->idList.size(); iter++)
-		mFriendListToChat.InsertString(iter, str2cstr(mMsgrClntDlg->idList[iter].id));
+		mFriendListToChat.InsertString((int)iter, str2cstr(mMsgrClntDlg->idList[iter].id));
 
 	return TRUE;
Index: /trunk/msvc14/ChevMsgrClient_MFC/ChevMsgrClient_MFCDlg.cpp
===================================================================
--- /trunk/msvc14/ChevMsgrClient_MFC/ChevMsgrClient_MFCDlg.cpp	(revision 32)
+++ /trunk/msvc14/ChevMsgrClient_MFC/ChevMsgrClient_MFCDlg.cpp	(revision 33)
@@ -136,5 +136,5 @@
 	{
 		AfxMessageBox(_T("¼­¹ö Á¤º¸ ÆÄÀÏÀ» Ã£À» ¼ö ¾øÀ½"));
-		::SendMessage(GetSafeHwnd(), WM_QUIT, NULL, NULL);
+		exit(1);
 	}
 	std::string ip;
@@ -147,5 +147,5 @@
 	{
 		AfxMessageBox(str2cstr(chev.getLastError()));
-		::SendMessage(GetSafeHwnd(), WM_QUIT, NULL, NULL);
+		exit(1);
 	}
 
@@ -155,5 +155,5 @@
 	{
 		AfxMessageBox(_T("login failed"));
-		::SendMessage(GetSafeHwnd(), WM_QUIT, NULL, NULL);
+		exit(1);
 	}
 
@@ -243,5 +243,5 @@
 				SensitiveCtrl sc;
 
-				sc.sensitiveIdx = gDlg->scl[idx].chatList.size();
+				sc.sensitiveIdx = (int)gDlg->scl[idx].chatList.size();
 				sc.timestamp = (int)time(NULL);
 				gDlg->scl[idx].sensitiveCtrl.push_back(sc);
@@ -341,5 +341,5 @@
 			SensitiveCtrl sc;
 
-			sc.sensitiveIdx = gDlg->scl[idx].chatList.size();
+			sc.sensitiveIdx = (int)gDlg->scl[idx].chatList.size();
 			sc.timestamp = (int)time(NULL);
 			gDlg->scl[idx].sensitiveCtrl.push_back(sc);
Index: /trunk/msvc14/ChevMsgrClient_MFC/LoginDlg.cpp
===================================================================
--- /trunk/msvc14/ChevMsgrClient_MFC/LoginDlg.cpp	(revision 32)
+++ /trunk/msvc14/ChevMsgrClient_MFC/LoginDlg.cpp	(revision 33)
@@ -59,4 +59,10 @@
 
 	GetDlgItemText(IDC_EDIT_LOGIN_ID, id);
+	if (id == _T(""))
+	{
+		AfxMessageBox(_T("No ID"));
+		return;
+	}
+
 	std::string name = cf::codec::hex::getInstance()->encode(c.sha256(cf::bin(cstr2str(id))));
 	std::ifstream f(name);
@@ -70,4 +76,10 @@
 
 	GetDlgItemText(IDC_EDIT_LOGIN_PW, pw);
+	if (pw == _T(""))
+	{
+		AfxMessageBox(_T("No Password"));
+		return;
+	}
+
 	f >> str;
 
